diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-12-10 00:36:31 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-12-10 00:36:31 -0300 |
commit | 9e42cd86869dcc158b0321b2d2dfcc185a7d0282 (patch) | |
tree | a8d67fd8202716b35c3552c21db17ecc356f2ffe /railties/lib/rails/generators/test_unit | |
parent | 05e6123653b7ceb98960403ec40788b3f34e3efd (diff) | |
parent | 190f638d398edf70fef0c32a389ed84a449bccb8 (diff) | |
download | rails-9e42cd86869dcc158b0321b2d2dfcc185a7d0282.tar.gz rails-9e42cd86869dcc158b0321b2d2dfcc185a7d0282.tar.bz2 rails-9e42cd86869dcc158b0321b2d2dfcc185a7d0282.zip |
Merge branch 'scaffold_fixes'
Diffstat (limited to 'railties/lib/rails/generators/test_unit')
-rw-r--r-- | railties/lib/rails/generators/test_unit/model/templates/fixtures.yml | 6 | ||||
-rw-r--r-- | railties/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb | 9 |
2 files changed, 6 insertions, 9 deletions
diff --git a/railties/lib/rails/generators/test_unit/model/templates/fixtures.yml b/railties/lib/rails/generators/test_unit/model/templates/fixtures.yml index 5c8780aa64..b2bcaf63be 100644 --- a/railties/lib/rails/generators/test_unit/model/templates/fixtures.yml +++ b/railties/lib/rails/generators/test_unit/model/templates/fixtures.yml @@ -3,12 +3,14 @@ <% unless attributes.empty? -%> one: <% attributes.each do |attribute| -%> - <%= attribute.name %>: <%= attribute.default %> + <%= attribute.column_name %>: <%= attribute.default %> + <%= "#{attribute.name}_type: #{attribute.human_name}" if attribute.polymorphic? %> <% end -%> two: <% attributes.each do |attribute| -%> - <%= attribute.name %>: <%= attribute.default %> + <%= attribute.column_name %>: <%= attribute.default %> + <%= "#{attribute.name}_type: #{attribute.human_name}" if attribute.polymorphic? %> <% end -%> <% else -%> # This model initially had no columns defined. If you add columns to the diff --git a/railties/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb b/railties/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb index 3b4fec2e83..8f3ecaadea 100644 --- a/railties/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +++ b/railties/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb @@ -18,17 +18,12 @@ module TestUnit # :nodoc: private def attributes_hash - return if accessible_attributes.empty? + return if attributes_names.empty? - accessible_attributes.map do |a| - name = a.name + attributes_names.map do |name| "#{name}: @#{singular_table_name}.#{name}" end.sort.join(', ') end - - def accessible_attributes - attributes.reject(&:reference?) - end end end end |