Class: Workarea::DiscountGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- Workarea::DiscountGenerator
- Defined in:
- lib/generators/workarea/discount/discount_generator.rb
Overview
Generates a new Workarea::Pricing::Discount
class
Instance Method Summary collapse
- #copy_model ⇒ Object
- #copy_select_type_partial ⇒ Object
- #copy_view_model ⇒ Object
- #copy_views ⇒ Object
Instance Method Details
#copy_model ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/generators/workarea/discount/discount_generator.rb', line 6 def copy_model template( 'model.rb.erb', "app/models/workarea/pricing/discount/#{file_name}.rb" ) template( 'model_test.rb.erb', "test/models/workarea/pricing/discount/#{file_name}_test.rb" ) end |
#copy_select_type_partial ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/generators/workarea/discount/discount_generator.rb', line 35 def copy_select_type_partial template( 'select_type_partial.rb.erb', "app/views/workarea/admin/create_pricing_discounts/_#{file_name}.html.haml" ) relative_file_path = "workarea/admin/create_pricing_discounts/#{file_name}" append_to_file 'config/initializers/workarea.rb' do "\nWorkarea::Plugin.append_partials('admin.create_pricing_discounts.setup', '#{relative_file_path}')\n" end end |
#copy_view_model ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/generators/workarea/discount/discount_generator.rb', line 17 def copy_view_model template( 'view_model.rb.erb', "app/view_models/workarea/admin/discounts/#{file_name}_view_model.rb" ) template( 'view_model_test.rb.erb', "test/view_models/workarea/admin/discounts/#{file_name}_view_model_test.rb" ) end |
#copy_views ⇒ Object
28 29 30 31 32 33 |
# File 'lib/generators/workarea/discount/discount_generator.rb', line 28 def copy_views template( 'partial.html.haml', "app/views/workarea/admin/pricing_discounts/properties/_#{file_name}.html.haml" ) end |