On 16 March 2014 04:46, Brandon <[email protected]> wrote:
> So I have the following:
>
>     flash[:success] = 'Your payment has completed. Please contact ' +
>                              @order.seller.name + ' (mobile: ' +
>                              @order.seller.mobile_number + ', email: ' +
>                              @order.seller.email + ')'
>
> Strangely inside this method, I can't seem to do string interpolation and it
> prints '@order.seller.name'. So that is a strange issue.
>
> But the main thing that puzzles me is should I be replacing + with << here?
> I read somewhere the performance is better but I really hate seeing << in my
> code. It just seems ugly and raises my blood pressure for some reason.

I think this would be much more readable
flash[:success] = "Your payment has completed. Please contact
#{@order.seller.name}  (mobile: #{@order.seller.mobile_number}, email:
#{@order.seller.email} )"

Colin

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLs4mHK%3Doap4rQOUo61zvRq7ghMrAi%2B2iLNqoR1S2POZ3g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to