Tuesday, April 12, 2011

[Rails] Re: refactoring advice

ret = <<EOS
<div class='right wrapper'>"
<strong>#{current_user_full_name}</strong>"
......
EOS

On Apr 12, 8:48 am, Burebista <li...@ruby-forum.com> wrote:
> Hi Rcommunity!
>
> small refactoring question here. This is code:
>
>  def login_block
>       ret = ""
>       ret += "<div class='right wrapper'>"
>       ret +="<strong>#{current_user_full_name}</strong>"
>       ret += "<span>|</span>"
>       ret += image_tag("logout.png")
>       ret += "<span>#{link_to t('logout'),'#',:id =>
> 'fb_logout'}</span>"
>       ret += "</div>"
>
>       ret.html_safe
>  end
>
> is there a way to get rid of those ugly ret += ?
>
> --
> Posted viahttp://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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate