Class: LittleBrotherSetupGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- LittleBrotherSetupGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/little_brother_setup/little_brother_setup_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.next_migration_number(path) ⇒ Object
9 10 11 |
# File 'lib/generators/little_brother_setup/little_brother_setup_generator.rb', line 9 def self.next_migration_number(path) Time.now.utc.strftime("%Y%m%d%H%M%S") end |
Instance Method Details
#migration ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/generators/little_brother_setup/little_brother_setup_generator.rb', line 13 def migration unless watchers_table_exists? # SOURCE -> DESTINATION puts "* watchers table creation migration was created!" puts "* run rake db:migrate" migration_template "db/migrate/create_watchers.rb", "db/migrate/create_watchers.rb" end end |
#watchers_table_exists? ⇒ Boolean
21 22 23 |
# File 'lib/generators/little_brother_setup/little_brother_setup_generator.rb', line 21 def watchers_table_exists? ActiveRecord::Base.connection.table_exists?(:watchers) end |