diff options
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails_generator/generators/components/model/templates/model.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/railties/lib/rails_generator/generators/components/model/templates/model.rb b/railties/lib/rails_generator/generators/components/model/templates/model.rb index 8d4c89e912..8bf93b9e8b 100644 --- a/railties/lib/rails_generator/generators/components/model/templates/model.rb +++ b/railties/lib/rails_generator/generators/components/model/templates/model.rb @@ -1,2 +1,5 @@ class <%= class_name %> < ActiveRecord::Base +<% attributes.select { |a| a.type.to_s == 'references' }.each do |attribute| -%> + belongs_to :<%= attribute.name %> +<% end -%> end |