Class: DeviseSuspendableGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- DeviseSuspendableGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/devise_suspendable/devise_suspendable_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.next_migration_number(dirname) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/generators/devise_suspendable/devise_suspendable_generator.rb', line 14 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 |
.orm_has_migration? ⇒ Boolean
10 11 12 |
# File 'lib/generators/devise_suspendable/devise_suspendable_generator.rb', line 10 def self.orm_has_migration? Rails::Generators.[:rails][:orm] == :active_record end |
.source_root ⇒ Object
6 7 8 |
# File 'lib/generators/devise_suspendable/devise_suspendable_generator.rb', line 6 def self.source_root @_devise_source_root ||= File.("../templates", __FILE__) end |
Instance Method Details
#create_migration_file ⇒ Object
26 27 28 |
# File 'lib/generators/devise_suspendable/devise_suspendable_generator.rb', line 26 def create_migration_file migration_template 'migration.rb', "db/migrate/devise_add_suspendable_#{name.downcase}.rb" end |