Class: WillFilterGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- WillFilterGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/will_filter/will_filter_generator.rb
Class Method Summary collapse
-
.next_migration_number(dirname) ⇒ Object
Implement the required interface for Rails::Generators::Migration.
- .source_root ⇒ Object
Instance Method Summary collapse
Class Method Details
.next_migration_number(dirname) ⇒ Object
Implement the required interface for Rails::Generators::Migration.
44 45 46 47 48 49 50 |
# File 'lib/generators/will_filter/will_filter_generator.rb', line 44 def self.next_migration_number(dirname) if ActiveRecord::Base. Time.now.utc.strftime("%Y%m%d%H%M%S") else "%.3d" % (current_migration_number(dirname) + 1) end end |
.source_root ⇒ Object
39 40 41 |
# File 'lib/generators/will_filter/will_filter_generator.rb', line 39 def self.source_root @source_root ||= File.('../templates', __FILE__) end |
Instance Method Details
#create_migration_file ⇒ Object
52 53 54 55 |
# File 'lib/generators/will_filter/will_filter_generator.rb', line 52 def create_migration_file migration_template 'create_will_filter_filters.rb', 'db/migrate/create_will_filter_filters.rb' copy_file 'config.yml', 'config/will_filter/config.yml' end |