mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-22 22:06:50 +00:00
Use name reader
This commit is contained in:
parent
296970415a
commit
feaefeeef3
@ -23,7 +23,7 @@ module ActiveModel
|
||||
elsif use_id_key?
|
||||
id_key
|
||||
else
|
||||
@name
|
||||
name
|
||||
end
|
||||
end
|
||||
|
||||
@ -68,7 +68,7 @@ module ActiveModel
|
||||
end
|
||||
|
||||
def id_key
|
||||
"#{@name.to_s.singularize}_ids".to_sym
|
||||
"#{name.to_s.singularize}_ids".to_sym
|
||||
end
|
||||
|
||||
def serializables
|
||||
@ -97,12 +97,12 @@ module ActiveModel
|
||||
elsif polymorphic?
|
||||
object.class.to_s.pluralize.demodulize.underscore.to_sym
|
||||
else
|
||||
@name.to_s.pluralize.to_sym
|
||||
name.to_s.pluralize.to_sym
|
||||
end
|
||||
end
|
||||
|
||||
def id_key
|
||||
"#{@name}_id".to_sym
|
||||
"#{name}_id".to_sym
|
||||
end
|
||||
|
||||
def embeddable?
|
||||
|
||||
Loading…
Reference in New Issue
Block a user