Skip to content

Commit 81935c8

Browse files
committed
Restore has_one to generator
per #822 since it was readded in #725
1 parent f67fd97 commit 81935c8

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/generators/serializer/templates/serializer.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ class <%= class_name %>Serializer < <%= parent_class_name %>
33
attributes <%= attributes_names.map(&:inspect).join(", ") %>
44
end
55
<% association_names.each do |attribute| -%>
6-
attribute :<%= attribute %>
6+
has_one :<%= attribute %>
77
<% end -%>
88
<% end -%>

test/generators/serializer_generator_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def test_generates_attributes_and_associations
3838
run_generator
3939
assert_file "app/serializers/account_serializer.rb" do |serializer|
4040
assert_match(/^ attributes :id, :name, :description$/, serializer)
41-
assert_match(/^ attribute :business$/, serializer)
41+
assert_match(/^ has_one :business$/, serializer)
4242
end
4343
end
4444

0 commit comments

Comments
 (0)