Skip to content

Commit

Permalink
Use source_root instead of full template path.
Browse files Browse the repository at this point in the history
Resolves rails 3.1 error 'Could not find "/Users/matt/dev/github/friendly_id/lib/generators/../../generators/friendly_id/templates/create_slugs.rb" in any of your source paths. Please invoke FriendlyIdGenerator.source_root(PATH) with the PATH containing your templates. Currently you have no source paths.'
  • Loading branch information
spraints committed May 29, 2011
1 parent 491398a commit a84a9bc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/generators/friendly_id_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ class FriendlyIdGenerator < Rails::Generators::Base

include Rails::Generators::Migration

MIGRATIONS_FILE = File.join(File.dirname(__FILE__), "..", "..", "generators", "friendly_id", "templates", "create_slugs.rb")
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"

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

# Taken from ActiveRecord's migration generator
Expand Down

0 comments on commit a84a9bc

Please sign in to comment.