Skip to content

Commit 32343d4

Browse files
committed
Merge pull request #822 from bf4/fix_has_one
Replace has_one with attribute in template
2 parents 77fb050 + 79653ac commit 32343d4

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-
has_one :<%= attribute %>
6+
attribute :<%= attribute %>
77
<% end -%>
88
<% end -%>

test/serializers/generators_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def test_generates_attributes_and_associations
4646
run_generator
4747
assert_file "app/serializers/account_serializer.rb" do |serializer|
4848
assert_match(/^ attributes :id, :name, :description$/, serializer)
49-
assert_match(/^ has_one :business$/, serializer)
49+
assert_match(/^ attribute :business$/, serializer)
5050
end
5151
end
5252

0 commit comments

Comments
 (0)