On 29 June 2010 08:40, Carsten Gehling <[email protected]> wrote: > I have a site with a lot of view code like this: > > <p> > <%[email protected]%> > </p> > > Unfortunately a lot of old posts have had their users deleted, so the > code above breaks the entire view. I am working on a larger cleanup on > the code, but in the meantime I would like to make a quickfix to get the > views working. > > What I would like is to convert > > <%[email protected]%>
<%= @post.user.name if @post.user %> Colin > > to > > <%=(@post.user.name) rescue ''%> > > Is there any way to override <%= to do the above? Thus fixing all errors > on the spot. > > Thanks > > - Carsten > -- > Posted via http://www.ruby-forum.com/. > > -- > 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. > > -- 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.

