Class: MultirowCounterGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- MultirowCounterGenerator
- Extended by:
- ActiveRecord::Generators::Migration
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/multirow_counter_generator.rb
Instance Method Summary collapse
Instance Method Details
#create_migration ⇒ Object
12 13 14 |
# File 'lib/generators/multirow_counter_generator.rb', line 12 def create_migration migration_template 'multirow_counter_migration.rb', "db/migrate/add_#{counter_name}_counter_to_#{model_name}.rb" end |
#inject_code ⇒ Object
16 17 18 19 20 |
# File 'lib/generators/multirow_counter_generator.rb', line 16 def inject_code inject_into_file "app/models/#{model_name}.rb", :after => '/class <%= model_name.classify %>' do "multirow_counter :#{counter_name}, :rows => #{number_of_counter_rows}" end end |