Class: FriendlyIdGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
Rails::Generators::Migration
Defined in:
lib/generators/friendly_id_generator.rb

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Object) next_migration_number(dirname)

Taken from ActiveRecord's migration generator



17
18
19
20
21
22
23
# File 'lib/generators/friendly_id_generator.rb', line 17

def self.next_migration_number(dirname) #:nodoc:
  if ActiveRecord::Base.timestamped_migrations
    Time.now.utc.strftime("%Y%m%d%H%M%S")
  else
    "%.3d" % (current_migration_number(dirname) + 1)
  end
end

Instance Method Details

- (Object) copy_files(*args)



12
13
14
# File 'lib/generators/friendly_id_generator.rb', line 12

def copy_files(*args)
  migration_template 'create_slugs.rb', "db/migrate/create_slugs.rb" unless options["skip-migration"]
end