Great.. I knew it had to be something so simple.. You helped me get
past the brick wall!

I had not even considered that nearly 70% of my counties have no
coordinator!!!! DOH!

thanks for your help

On May 26, 10:13 am, Michael Pavling <[email protected]> wrote:
> On 26 May 2011 15:09, Aaron Mills <[email protected]> wrote:
>
> > This is now correct but the original issue is still
> > there.. which is when I try and call state.county.name or
> > coordinator.state.name or county.state.name.
>
> > I get this error:
> > undefined method `firstname' for nil:NilClass
>
> That's a *different* error to what you had before.
> That's telling you that the thing you're trying to call ".firstname"
> on is nil. ie: there is no coordinator for the given county.
>
> You can guard against this error any number of ways, an easy one being:
>   <%= county.coordinator.firstname if county.coordinator %>

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

Reply via email to