In Rails 2 generators, it’s possible to pass data to the template in the following manner:
record.template(
"src.html.erb",
"dest.html.erb",
:assigns => { :id => id, :name => name }
In Rails 3, it looks like template is the new method. Unfortunately, it looks like the third parameter, config, only accepts a :verbose option. Attempting to pass values via :assigns doesn’t seem to work.
Does anyone know how I can pass dynamic value to my Rails 3 template?
Example of passing parameters to views in Rails 3.
https://github.com/rails/rails/blob/master/railties/lib/rails/generators/erb/controller/controller_generator.rb
Template:
https://github.com/rails/rails/blob/master/railties/lib/rails/generators/erb/controller/templates/view.html.erb