Move duplicated code to the Base class

This commit is contained in:
Santiago Pastorino 2013-05-15 15:43:37 -07:00
parent 03669a74bc
commit 85bf3d2f3d

View File

@ -45,6 +45,14 @@ module ActiveModel
!associated_object.nil?
end
def embed_key
if key = options[:embed_key]
key
else
:id
end
end
protected
def find_serializable(object)
@ -71,14 +79,6 @@ module ActiveModel
end
end
def embed_key
if key = options[:embed_key]
key
else
:id
end
end
def id_key
"#{@name.to_s.singularize}_ids".to_sym
end
@ -135,14 +135,6 @@ module ActiveModel
end
end
def embed_key
if key = options[:embed_key]
key
else
:id
end
end
def id_key
"#{@name}_id".to_sym
end