Add key option to serializer associations

This commit is contained in:
Rodrigo Ra
2015-07-05 19:47:58 -03:00
parent ac1991fd6b
commit df63b59512
8 changed files with 109 additions and 29 deletions

View File

@@ -220,8 +220,9 @@ module ActiveModel
association_options[:association_options][:virtual_value] = association_value
end
association_key = association_options[:association_options][:key] || name
if block_given?
block.call(name, serializer, association_options[:association_options])
block.call(association_key, serializer, association_options[:association_options])
end
end
end