Handle correctly null associations

null belongs_to associations are now serialized as nil instead
of raise an error during serialization.
This commit is contained in:
Guillermo Iguaran
2014-10-30 09:35:05 -05:00
parent baf3db1365
commit 19ac139880
12 changed files with 64 additions and 17 deletions

View File

@@ -43,6 +43,7 @@ PostSerializer = Class.new(ActiveModel::Serializer) do
attributes :title, :body, :id
has_many :comments
belongs_to :author
url :comments
end