title: How to override a rails generator template in a gem?
body: <p>When you want to override a generator template (without replacing the generator itself), in Rails 3 you can just drop files in appropriately named places in lib/templates and Rails will find them.</p>
  
  <p>What if you want to do this with a gem?  I'm trying to take my team's standardized scaffold format and gemify it so we can share it in all projects and update it easily, rather than copy files into lib/ in every project.   This works fine for the cases where I've created a new generator; I hook into it with config.generators in application.rb and Rails finds it.   But when I drop template files into lib/templates in the <em>gem</em>, Rails finds its own default templates first, and renders them instead of mine.  I think the search order is RAILS_ROOT/lib/templates, RAILS_GEMS/lib/templates, OTHER_GEMS/lib/templates.</p>
  
  <p>What's the solution?   I'm not finding much docco on this, and code-diving through Rails hasn't presented an obvious solution.   Thanks!</p>