Permalink
Browse files

Allow custom rails generators to pass in their own binding to Create …

…command so that the corresponding erb templates get rendered with the proper binding [#1493 state:resolved]
  • Loading branch information...
1 parent 1e45818 commit 1f0aecd931a9292b52402143be979ab4c06f06cd @josh josh committed Dec 28, 2008
Showing with 1 addition and 1 deletion.
  1. +1 −1 railties/lib/rails_generator/commands.rb
@@ -294,7 +294,7 @@ def template(relative_source, relative_destination, template_options = {})
file(relative_source, relative_destination, template_options) do |file|
# Evaluate any assignments in a temporary, throwaway binding.
vars = template_options[:assigns] || {}
- b = binding
+ b = template_options[:binding] || binding
vars.each { |k,v| eval "#{k} = vars[:#{k}] || vars['#{k}']", b }
# Render the source file with the temporary binding.

0 comments on commit 1f0aecd

Please sign in to comment.