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 With show.html.erb file it''s render. Thanks -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/OH33jczSjfQJ. For more options, visit https://groups.google.com/groups/opt_out.
See u database schema 2012/8/13 Lucas Lima de Souza <lucaslima4p-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>> 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 > > > With show.html.erb file it''s render. > > Thanks > > > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit > https://groups.google.com/d/msg/rubyonrails-talk/-/OH33jczSjfQJ. > For more options, visit https://groups.google.com/groups/opt_out. > > >-- att, Rogerio A complicação se descomplica na mesma proporção que fazemos os nós se desatarem ao tecer o conhecimento do saber. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
On 13 August 2012 14:04, Lucas Lima de Souza <lucaslima4p-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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:NilClassIs 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.