mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-24 06:46: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?
|
elsif use_id_key?
|
||||||
id_key
|
id_key
|
||||||
else
|
else
|
||||||
@name
|
name
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ module ActiveModel
|
|||||||
end
|
end
|
||||||
|
|
||||||
def id_key
|
def id_key
|
||||||
"#{@name.to_s.singularize}_ids".to_sym
|
"#{name.to_s.singularize}_ids".to_sym
|
||||||
end
|
end
|
||||||
|
|
||||||
def serializables
|
def serializables
|
||||||
@ -97,12 +97,12 @@ module ActiveModel
|
|||||||
elsif polymorphic?
|
elsif polymorphic?
|
||||||
object.class.to_s.pluralize.demodulize.underscore.to_sym
|
object.class.to_s.pluralize.demodulize.underscore.to_sym
|
||||||
else
|
else
|
||||||
@name.to_s.pluralize.to_sym
|
name.to_s.pluralize.to_sym
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def id_key
|
def id_key
|
||||||
"#{@name}_id".to_sym
|
"#{name}_id".to_sym
|
||||||
end
|
end
|
||||||
|
|
||||||
def embeddable?
|
def embeddable?
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user