Hello, Is there a better way to do the following in a view? <td>Manufacturer <td><%= @equipment.manufacturer.name unless @equipment.manufacturer.nil? %> -- Posted via http://www.ruby-forum.com/.
Jim wrote:> Hello, > > Is there a better way to do the following in a view? > > <td>Manufacturer <td><%= @equipment.manufacturer.name unless > @equipment.manufacturer.nil? %> > > >I don'' know about better, but <td>Manufacturer <td><%= @equipment.manufacturer.name rescue "unknown" %> would be shorter. -- stefan -- For rails performance tuning, see: http://railsexpress.de/blog Subscription: http://railsexpress.de/blog/xml/rss20/feed.xml
Jim wrote:> Hello, > > Is there a better way to do the following in a view? > > <td>Manufacturer <td><%= @equipment.manufacturer.name unless > @equipment.manufacturer.nil? %>See this thread also: http://www.ruby-forum.com/topic/53865#new -- Posted via http://www.ruby-forum.com/.