Reputation: 187
It seems that I am stuck figuring out so that my generator doesn't need an argument. So for instance my generator code is this:
class MyGenerator < Rails::Generators::NamedBase
source_root File.expand_path('../templates', __FILE__)
def generate_stylesheet
copy_file "my.css", "public/stylesheets/my.css"
end
end
But when I do rails g my
rails always asks for an extra argument. Can you show me how so it doesn't need an extra argument?
Thanks.
Upvotes: 7
Views: 831
Reputation: 3357
You have to use class MyGenerator < Rails::Generators::Base
instead of class MyGenerator < Rails::Generators::NamedBase
Upvotes: 11