Ruby on Rails Saturday, December 25, 2010

On 26 December 2010 00:35, Jeffrey L. Taylor <ror@abluz.dyndns.org> wrote:
> Quoting Mauro <mrsanna1@gmail.com>:
>> I have:
>> <%= form_for(@supplier) do |f| %>
>> .......
>> ......
>> <%= render 'sector_categories', :locals => {:f => f} %>
>>
>> in _sector_categories partial I have:
>>
>> <div class="field">
>>   <div id="category_update">
>>     <% for category in @categories %>
>>       <%= f.check_box :category_ids[], category.id,
>> @supplier.categories.include?(category) %>
>>       <%= category.name %><br />
>>     <% end %>
>>   </div>
>> </div>
>>
>> Why it says: undefined local variable or method "f"?
>>
>
> As written, you are rendering a template, not a partial.  Passing local
> variables to templates is not supported.  Do you mean
>
>  <%= render :partial => 'sector_categories', :locals => {:f => f} %>

As you see in http://guides.rubyonrails.org/layouts_and_rendering.html
there is no need to specify :partial.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment