Class: Agendare::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- Agendare::Generators::InstallGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/agendare/install/install_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.next_migration_number(path) ⇒ Object
35 36 37 38 |
# File 'lib/generators/agendare/install/install_generator.rb', line 35 def self.next_migration_number(path) @migration_number = current_migration_number(path) + 1 ActiveRecord::Migration.next_migration_number(@migration_number) end |
Instance Method Details
#add_controllers ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/generators/agendare/install/install_generator.rb', line 10 def add_controllers if (file_name == "controllers") generate("controller" , "schedules") generate("controller" , "scheduleds") generate("controller" , "users") end end |
#add_migrations ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/generators/agendare/install/install_generator.rb', line 26 def add_migrations if (file_name == "migrations") migration_template("create_scheduled.rb" , "db/migrate/create_scheduled.rb") migration_template("create_user.rb" , "db/migrate/create_user.rb") migration_template("create_schedule.rb" , "db/migrate/create_schedule.rb") migration_template("add_index_schedule.rb", "db/migrate/add_index_schedule.rb") end end |
#add_models ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/generators/agendare/install/install_generator.rb', line 18 def add_models if (file_name == "models") copy_file "schedule.rb" , "app/models/schedule.rb" copy_file "scheduled.rb" , "app/models/scheduled.rb" copy_file "user.rb" , "app/models/user.rb" end end |