Imported from Lighthouse. Original ticket at: http://rails.lighthouseapp.com/projects/8994/tickets/6521
Created by Steve Hodgkiss - 2011-03-04 14:33:23 UTC
I'm trying to use the AppGenerator inside an engine, and the copy_file method is going directly to fileutils instead of using the thor actions method. The error is on master, it works on 3.0.5.
rake generate looks something like this:
class TestAppGenerator < Rails::Generators::AppBase
source_root File.expand_path("../templates", __FILE__)
invoke Rails::Generators::AppGenerator, ["spec/dummy"]
% rake generate --trace
** Invoke generate (first_time)
** Execute generate
wrong number of arguments (1 for 2)
Using git diff I've tracked it down to the removal of a bunch of methods being defined in 3.0.5 which are removed in master.
git diff v3.0.5..master railties/lib/rails/generators/rails/app/app_generator.rb
0904e82 - This is the commit that stops it working, although I find it strange that it's from October last year and it's not in the 3.0.5 release. Maybe I'm looking at the wrong commit.
In any case adding the method definitions back solves the problem I'm having. I can't figure out why it fails in this case but works fine through the rails command though...
Imported from Lighthouse.
Comment by Steve Hodgkiss - 2011-03-06 14:09:36 UTC
This is due running it with rake, where FileUtils is included into the top level module causing method_missing not to be used on Rails::ActionMethods.
I've put an example on github that demonstrates this - https://github.com/stevehodgkiss/rails-ticket-8994
Attachments saved to Gist: http://gist.github.com/971800
This was fixed by commit 00379ee