class Governor::AddStateGenerator

Public Class Methods

next_migration_number(dirname) click to toggle source
# File lib/generators/governor/add_state_generator.rb, line 10
def self.next_migration_number(dirname)
  if ActiveRecord::Base.timestamped_migrations
    Time.new.utc.strftime("%Y%m%d%H%M%S")
  else
    "%.3d" % (current_migration_number(dirname) + 1)
  end
end

Public Instance Methods

create_migration_file() click to toggle source
# File lib/generators/governor/add_state_generator.rb, line 18
def create_migration_file
  migration_template 'migrations/add_state_to_articles.rb', "db/migrate/governor_add_state_to_#{mapping.plural}.rb", :skip => true
end

Private Instance Methods

mapping() click to toggle source
# File lib/generators/governor/add_state_generator.rb, line 23
def mapping
  Governor.resources[resource.pluralize.to_sym]
end