merge upstream update fieldset

This commit is contained in:
Aaron Renoir
2014-11-13 17:45:47 -08:00
22 changed files with 623 additions and 148 deletions

View File

@@ -21,7 +21,6 @@ module ActiveModel
def self.attributes(*attrs)
@_attributes.concat attrs
attrs.each do |attr|
define_method attr do
object.read_attribute_for_serialization(attr)
@@ -29,6 +28,14 @@ module ActiveModel
end
end
def self.attribute(attr, options = {})
key = options.fetch(:key, attr)
@_attributes.concat [key]
define_method key do
object.read_attribute_for_serialization(attr)
end unless method_defined?(key)
end
# Defines an association in the object should be rendered.
#
# The serializer object should implement the association name
@@ -83,8 +90,7 @@ module ActiveModel
def self.adapter
adapter_class = case config.adapter
when Symbol
class_name = "ActiveModel::Serializer::Adapter::#{config.adapter.to_s.classify}"
class_name.safe_constantize
ActiveModel::Serializer::Adapter.adapter_class(config.adapter)
when Class
config.adapter
end