Module: ActiveAdminRole::Generators::Helper::ClassMethods

Defined in:
lib/generators/active_admin_role/helper.rb

Instance Method Summary collapse

Instance Method Details

#next_migration_number(dirname) ⇒ Object

Define the next_migration_number method (necessary for the migration_template method to work)



53
54
55
56
57
58
59
60
# File 'lib/generators/active_admin_role/helper.rb', line 53

def next_migration_number(dirname)
  if ActiveRecord::Base.timestamped_migrations
    sleep 1 # make sure each time we get a different timestamp
    Time.new.utc.strftime("%Y%m%d%H%M%S")
  else
    "%.3d" % (current_migration_number(dirname) + 1)
  end
end