mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
Allow to set key for associations through options
This commit is contained in:
@@ -45,7 +45,7 @@ module ActiveModel
|
||||
|
||||
class HasOne < Association
|
||||
def key
|
||||
"#{name}_id"
|
||||
@options[:key] || "#{name}_id"
|
||||
end
|
||||
|
||||
def embedded_key
|
||||
@@ -55,7 +55,7 @@ module ActiveModel
|
||||
|
||||
class HasMany < Association
|
||||
def key
|
||||
"#{name.singularize}_ids"
|
||||
@options[:key] || "#{name.singularize}_ids"
|
||||
end
|
||||
|
||||
def embedded_key
|
||||
|
||||
Reference in New Issue
Block a user