On 10 September 2010 09:25, Mauro <[email protected]> wrote:
> If you know grails, there is a feature like this: <% user.name? %>
> that prevents to chek if the value is null or not.
> In rails view I have to do
> <% if user.name %>
>  <%= user.name %>
> <% end %>
> to display user.name if it is not nil.

Not a general solution I know, but in such a situation I supply a
method of User, display_name, that returns the name or empty string
(or "Unknown" possibly, dependent on requirement).

Colin

-- 
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