diff --git a/lib/generators/serializer/templates/serializer.rb b/lib/generators/serializer/templates/serializer.rb index b1342098b..4ebb004e2 100644 --- a/lib/generators/serializer/templates/serializer.rb +++ b/lib/generators/serializer/templates/serializer.rb @@ -1,8 +1,8 @@ <% module_namespacing do -%> class <%= class_name %>Serializer < <%= parent_class_name %> attributes <%= attributes_names.map(&:inspect).join(", ") %> -end <% association_names.each do |attribute| -%> has_one :<%= attribute %> <% end -%> +end <% end -%> diff --git a/test/generators/serializer_generator_test.rb b/test/generators/serializer_generator_test.rb index b5cd4abf2..815468b7b 100644 --- a/test/generators/serializer_generator_test.rb +++ b/test/generators/serializer_generator_test.rb @@ -39,6 +39,7 @@ def test_generates_attributes_and_associations assert_file "app/serializers/account_serializer.rb" do |serializer| assert_match(/^ attributes :id, :name, :description$/, serializer) assert_match(/^ has_one :business$/, serializer) + assert_match(/^end\n*\z/, serializer) end end