Perfect...thanks!

On Mar 7, 4:02 am, Michael Pavling <pavl...@gmail.com> wrote:
> On 7 March 2010 00:26, ObjectEvolution <objectevolut...@gmail.com> wrote:
>
> >                <% c.thing2.each do |be| %>
> >                        <tr>
> >                                <td>
> >                                       <%=h be.workout_type %></td>
> >                                       <%=h be.thing3.name %>
> >                                </td>
> >                        </tr>
> >                <% end %>
>
> > I get:
> > undefined method `name' for nil:NilClass
>
> > I'm assuming this means there is no Thing3 object for this particular
> > Thing2 object.
>
> you're quite correct - there's no "thing3" linked to a given "thing 2".
> If there *supposed* to be an associated object there, then something's
> gone wrong when you've created your objects, but if it's a case that
> there may or may not be a Thing3, then a simple "guard" would suffice.
>
> <%=h be.thing3.name if be.thing3 %>

-- 
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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to