sync with upstream

This commit is contained in:
Theodore Konukhov
2014-08-29 06:28:13 +02:00
10 changed files with 584 additions and 65 deletions

View File

@@ -0,0 +1,22 @@
module ActiveModel
class Serializer
class Association
class HasOne < Association
def initialize(name, *args)
super
@root_key = @embedded_key.to_s.pluralize
@key ||= "#{name}_id"
end
def serializer_class(object, options = {})
serializer_from_options || serializer_from_object(object, options) || default_serializer
end
def build_serializer(object, options = {})
options[:_wrap_in_array] = embed_in_root?
super
end
end
end
end
end