mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 15:23:06 +00:00
do not generate id method (was for 1.8 only)
see https://github.com/rails-api/active_model_serializers/issues/127 for original motivation
This commit is contained in:
@@ -4,16 +4,5 @@ class <%= class_name %>Serializer < <%= parent_class_name %>
|
||||
<% association_names.each do |attribute| -%>
|
||||
has_one :<%= attribute %>
|
||||
<% end -%>
|
||||
<% if generate_id_method %>
|
||||
|
||||
# due to the difference between 1.8 and 1.9 with respect to #id and
|
||||
# #object_id, we recommend that if you wish to serialize id columns, you
|
||||
# do this. Feel free to remove this if you don't feel that it's appropriate.
|
||||
#
|
||||
# For more: https://github.com/rails-api/active_model_serializers/issues/127
|
||||
def id
|
||||
object.read_attribute_for_serialization(:id)
|
||||
end
|
||||
<% end -%>
|
||||
end
|
||||
<% end -%>
|
||||
|
||||
Reference in New Issue
Block a user