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<https://github.com/rails/rails/blob/master/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 (
railties/lib/rails/generators/named_base.rb<https://github.com/rails/rails/blob/master/railties/lib/rails/generators/named_base.rb>
):
      # 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
            super
          end
        end
      end

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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/2328b9a7-c5f2-4146-b375-99fd66fd73bb%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to