Class: Lexoranking::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Lexoranking::Generators::InstallGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/lexoranking/install_generator.rb
Constant Summary collapse
- RANKING_COLUMN =
:rank
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.next_migration_number(path) ⇒ Object
10 11 12 13 |
# File 'lib/generators/lexoranking/install_generator.rb', line 10 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_migrations ⇒ Object
19 20 21 22 23 |
# File 'lib/generators/lexoranking/install_generator.rb', line 19 def copy_migrations validates_ranking_column! migration_template "migration.rb", "db/migrate/add_#{column}_to_#{model_name}.rb" end |
#setup ⇒ Object
15 16 17 |
# File 'lib/generators/lexoranking/install_generator.rb', line 15 def setup @model_name = .model.pluralize end |