ActiveModel::AttributeAssignment requires Model#respond_to_missing?

This commit is contained in:
Benjamin Fleischer 2015-11-24 14:07:48 -06:00
parent a9ce4fb766
commit d2a11678ef

View File

@ -16,6 +16,12 @@ class Model < ActiveModelSerializers::Model
end
end
# required for ActiveModel::AttributeAssignment#_assign_attribute
# in Rails 5
def respond_to_missing?(method_name, _include_private = false)
attributes.key?(method_name.to_s.tr('=', '').to_sym) || super
end
def cache_key_with_digest
"#{cache_key}/#{FILE_DIGEST}"
end