Class: Approval2::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Approval2::Generators::InstallGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/approval2/install/install_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.next_migration_number(path) ⇒ Object
11 12 13 14 |
# File 'lib/generators/approval2/install/install_generator.rb', line 11 def self.next_migration_number(path) next_migration_number = current_migration_number(path) + 1 ActiveRecord::Migration.next_migration_number(next_migration_number) end |
Instance Method Details
#copy_controllers ⇒ Object
31 32 33 |
# File 'lib/generators/approval2/install/install_generator.rb', line 31 def copy_controllers copy_file "unapproved_records_controller.rb", "#{Rails.root}/app/controllers/unapproved_records_controller.rb" end |
#copy_migrations ⇒ Object
16 17 18 |
# File 'lib/generators/approval2/install/install_generator.rb', line 16 def copy_migrations migration_template "create_unapproved_records.rb", "db/migrate/create_unapproved_records.rb" end |
#copy_models ⇒ Object
20 21 22 |
# File 'lib/generators/approval2/install/install_generator.rb', line 20 def copy_models copy_file "unapproved_record.rb", "#{Rails.root}/app/models/unapproved_record.rb" end |
#copy_views ⇒ Object
24 25 26 27 28 29 |
# File 'lib/generators/approval2/install/install_generator.rb', line 24 def copy_views ["index.html.haml", "_approve.html.haml"].each do |v| copy_file v, "#{Rails.root}/app/views/unapproved_records/#{v}" copy_file v, "#{Rails.root}/app/views/unapproved_records/#{v}" end end |