Skip to content

Commit

Permalink
Added back generator from 4.0.0 branch
Browse files Browse the repository at this point in the history
[ci skip]
  • Loading branch information
norman committed Aug 15, 2011
1 parent 506275c commit 57ad767
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lib/generators/friendly_id_generator.rb
@@ -1,16 +1,16 @@
require 'rails/generators'
require 'rails/generators/migration'

# This generator adds a migration for the {FriendlyId::History
# FriendlyId::History} addon.
class FriendlyIdGenerator < Rails::Generators::Base

include Rails::Generators::Migration

source_root File.expand_path('../../../generators/friendly_id/templates', __FILE__)

class_option :"skip-migration", :type => :boolean, :desc => "Don't generate a migration for the slugs table"
source_root File.expand_path('../../friendly_id', __FILE__)

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

# Taken from ActiveRecord's migration generator
Expand All @@ -21,5 +21,4 @@ def self.next_migration_number(dirname) #:nodoc:
"%.3d" % (current_migration_number(dirname) + 1)
end
end

end

0 comments on commit 57ad767

Please sign in to comment.