El domingo, 16 de marzo de 2014 09:54:06 UTC+1, Colin Law escribió:
>
> On 16 March 2014 04:46, Brandon <[email protected] <javascript:>> 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
>
That s really odd, I think that writing like: flash[:success] = "Your
payment has completed. Please contact #{@order.seller.name} (mobile:
#{@order.seller.mobile_number}, email:
#{@order.seller.email} )" should interpolate it.
The only rule I know is that double quotes are the ones to use in string
interpolation.
I hope you found the solution.
And please if you find it share it.
--
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/b995ad8a-76fb-4220-b651-2a38b7309b26%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.