diff --git a/lib/generators/serializer/templates/serializer.rb b/lib/generators/serializer/templates/serializer.rb index 0ac5822c4..b1342098b 100644 --- a/lib/generators/serializer/templates/serializer.rb +++ b/lib/generators/serializer/templates/serializer.rb @@ -3,6 +3,6 @@ class <%= class_name %>Serializer < <%= parent_class_name %> attributes <%= attributes_names.map(&:inspect).join(", ") %> end <% association_names.each do |attribute| -%> - attribute :<%= attribute %> + has_one :<%= attribute %> <% end -%> <% end -%> diff --git a/test/generators/serializer_generator_test.rb b/test/generators/serializer_generator_test.rb index e5930b89b..b5cd4abf2 100644 --- a/test/generators/serializer_generator_test.rb +++ b/test/generators/serializer_generator_test.rb @@ -38,7 +38,7 @@ def test_generates_attributes_and_associations run_generator assert_file "app/serializers/account_serializer.rb" do |serializer| assert_match(/^ attributes :id, :name, :description$/, serializer) - assert_match(/^ attribute :business$/, serializer) + assert_match(/^ has_one :business$/, serializer) end end