Hello,
Is there a better way to do the following in a view?
Hello,
Is there a better way to do the following in a view?
Jim wrote:
Hello,
Is there a better way to do the following in a view?
Manufacturer <%= @equipment.manufacturer.name unless @equipment.manufacturer.nil? %>
I don’ know about better, but
Manufacturer <%= @equipment.manufacturer.name rescue "unknown" %>would be shorter.
– stefan
–
For rails performance tuning, see: http://railsexpress.de/blog
Subscription: railsexpress.de
Jim wrote:
Hello,
Is there a better way to do the following in a view?
Manufacturer <%= @equipment.manufacturer.name unless @equipment.manufacturer.nil? %>
See this thread also:
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs