mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-23 06:16:50 +00:00
Merge pull request #971 from bf4/readd_has_one_to_generator
Restore has_one to generator
This commit is contained in:
commit
c0a82648d5
@ -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 -%>
|
||||
|
||||
@ -38,7 +38,7 @@ class SerializerGeneratorTest < Rails::Generators::TestCase
|
||||
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
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user