In the rails documentation, it states that:

In Rails 3.0 and above, generators don't just look in the source root for
templates, they also search for templates in other paths. And one of them
is lib/templates. Since we want to customize
Rails::Generators::HelperGenerator, we can do that by simply making a
template copy inside lib/templates/rails/helper with the name helper.rb.

I'm trying to dig through the rails source code to see where this lookup
occurs. I've gotten this far.

In railties/lib/rails/generators/rails/helper/helper_generator.rb<>,
the code

template 'helper.rb', File.join('app/helpers', class_path, "#{file_name}_helper.rb")

seems to be calling the super class' method (
       # Defines the template that would be used for the migration file.
       # The arguments include the source template file, the migration
filename etc.
       no_tasks do
         def template(source, *args, &block)
           inside_template do

This in turn inherits from name_base inherits from base, but the method
"template" doesnt seem to appear in that class.

Where can I find the code that does this lookup?

You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
To view this discussion on the web visit
For more options, visit

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
postedAug 29, '13 at 10:06p
activeAug 29, '13 at 10:06p

1 user in discussion

Dan Oved: 1 post



site design / logo © 2021 Grokbase