Class: Mobility::BackendGenerators::Base
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- Mobility::BackendGenerators::Base
show all
- Includes:
- ActiveRecord::Generators::Migration, ActiveRecordMigrationCompatibility
- Defined in:
- lib/rails/generators/mobility/backend_generators/base.rb
Class Method Summary
collapse
Instance Method Summary
collapse
#activerecord_migration_class
Class Method Details
.next_migration_number(dirname) ⇒ Object
19
20
21
|
# File 'lib/rails/generators/mobility/backend_generators/base.rb', line 19
def self.next_migration_number(dirname)
::ActiveRecord::Generators::Base.next_migration_number(dirname)
end
|
Instance Method Details
#backend ⇒ Object
23
24
25
|
# File 'lib/rails/generators/mobility/backend_generators/base.rb', line 23
def backend
self.class.name.split('::').last.gsub(/Backend$/,'').underscore
end
|
#create_migration_file ⇒ Object
11
12
13
14
15
16
17
|
# File 'lib/rails/generators/mobility/backend_generators/base.rb', line 11
def create_migration_file
if behavior == :invoke && self.class.migration_exists?(migration_dir, migration_file)
::Kernel.warn "Migration already exists: #{migration_file}"
else
migration_template "#{template}.rb", "db/migrate/#{migration_file}.rb"
end
end
|