On 14 June 2015 at 08:27, Zlodiak Zlodiak <[email protected]> wrote: > ... > so I tried: > <div class="col-xs-2"><%= user.gender.gender_name %></div> > > in this case receives the following error message: > undefined method `gender_name' for nil:NilClass
One of your users does not have a gender associated, so user.gender is nil try <div class="col-xs-2"><%= user.gender.gender_name if user.gender %></div> Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLvy7%2BFS9mCvw-oTrduo3Gh65ysMkb-bE%3Dkb69iawKP0%2BQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

