File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed
lib/active_model/serializer/association Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,11 @@ class HasMany < Association
5
5
def initialize ( name , *args )
6
6
super
7
7
@root_key = @embedded_key
8
- @key ||= "#{ name . to_s . singularize } _ids"
8
+ @key ||= case CONFIG . default_key_type
9
+ when :name then name . to_s . pluralize
10
+ else "#{ name . to_s . singularize } _ids"
11
+ end
12
+
9
13
end
10
14
11
15
def serializer_class ( object , _ )
Original file line number Diff line number Diff line change @@ -5,7 +5,10 @@ class HasOne < Association
5
5
def initialize ( name , *args )
6
6
super
7
7
@root_key = @embedded_key . to_s . pluralize
8
- @key ||= "#{ name } _id"
8
+ @key ||= case CONFIG . default_key_type
9
+ when :name then name . to_s . singularize
10
+ else "#{ name } _id"
11
+ end
9
12
end
10
13
11
14
def serializer_class ( object , options = { } )
You can’t perform that action at this time.
0 commit comments