diff options
author | Piotr Sarnacki <drogus@gmail.com> | 2010-09-24 15:46:29 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-09-24 21:02:30 +0200 |
commit | bac0826b1fa5f39274d61ad51304548c725a304f (patch) | |
tree | a8389dc480a95838925e51954a5e0a2dc658c54c /activerecord/lib/rails/generators/active_record/model/templates | |
parent | e83634081a9222446df608106c8df5a6831d64db (diff) | |
download | rails-bac0826b1fa5f39274d61ad51304548c725a304f.tar.gz rails-bac0826b1fa5f39274d61ad51304548c725a304f.tar.bz2 rails-bac0826b1fa5f39274d61ad51304548c725a304f.zip |
Refactor namespaced generators to use module_namespacing block helper
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'activerecord/lib/rails/generators/active_record/model/templates')
-rw-r--r-- | activerecord/lib/rails/generators/active_record/model/templates/model.rb | 2 | ||||
-rw-r--r-- | activerecord/lib/rails/generators/active_record/model/templates/module.rb | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/lib/rails/generators/active_record/model/templates/model.rb b/activerecord/lib/rails/generators/active_record/model/templates/model.rb index 21ae29e9f2..5c47f8b241 100644 --- a/activerecord/lib/rails/generators/active_record/model/templates/model.rb +++ b/activerecord/lib/rails/generators/active_record/model/templates/model.rb @@ -1,5 +1,7 @@ +<% module_namespacing do -%> class <%= class_name %> < <%= parent_class_name.classify %> <% attributes.select {|attr| attr.reference? }.each do |attribute| -%> belongs_to :<%= attribute.name %> <% end -%> end +<% end -%> diff --git a/activerecord/lib/rails/generators/active_record/model/templates/module.rb b/activerecord/lib/rails/generators/active_record/model/templates/module.rb index bb4220f038..fca2908080 100644 --- a/activerecord/lib/rails/generators/active_record/model/templates/module.rb +++ b/activerecord/lib/rails/generators/active_record/model/templates/module.rb @@ -1,5 +1,7 @@ +<% module_namespacing do -%> module <%= class_path.map(&:camelize).join('::') %> def self.table_name_prefix '<%= class_path.join('_') %>_' end end +<% end -%> |