Thursday, August 16, 2012

Re: [Rails] Render collection of objects

On 13 August 2012 14:04, Lucas Lima de Souza <lucaslima4p@gmail.com> wrote:
> Hello!
>
> I'm trying to render a template this way (below), but the object is nil at
> _category.html.erb file.
>
> index.html.erb
> <%= render @categories %>
>
> _category.html.erb
>
> <%=category.name %>
>
> error:
>
> undefined method `name' for nil:NilClass

Is it possible that in _category.html.erb you are assigning a value to
category that is overwriting the passed in value with nil? Try
accessing displaying category.name in the first line of the partial.

Colin

--
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 https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate