class Emotions::Generators::InstallGenerator

Public Class Methods

next_migration_number(dirname) click to toggle source

Implement the required interface for Rails::Generators::Migration. taken from github.com/rails/rails/blob/master/activerecord/lib/generators/active_record.rb

# File lib/generators/emotions/install_generator.rb, line 12
def self.next_migration_number(dirname)
  if ActiveRecord::Base.timestamped_migrations
    Time.now.utc.strftime('%Y%m%d%H%M%S')
  else
    '%.3d'.format(current_migration_number(dirname) + 1)
  end
end

Public Instance Methods

create_migration_file() click to toggle source
# File lib/generators/emotions/install_generator.rb, line 20
def create_migration_file
  migration_template 'migration.rb', 'db/migrate/add_emotions.rb'
end
create_model_file() click to toggle source
# File lib/generators/emotions/install_generator.rb, line 24
def create_model_file
  template 'model.rb', 'app/models/emotion.rb'
end