Skip to content

Instantly share code, notes, and snippets.

@joncode
Created May 21, 2012 19:51
Show Gist options
  • Select an option

  • Save joncode/2764257 to your computer and use it in GitHub Desktop.

Select an option

Save joncode/2764257 to your computer and use it in GitHub Desktop.
instance variables into Partials
<%= render 'option_associations',option: option, collection:[ @body_types, @themes, @products] %>
in this example, instance variables are @options, @body_types, @themes, @products
@options.each do |option|
--- partial is rendered with option and the collection instance variables ...
use collection: to push instance variables into a partial
use option: option -- to push local variable into partial as local variable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment