Forum: Ruby on Rails newbie: %Q method?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Jeff E. (Guest)
on 2007-03-27 21:07
(Received via mailing list)
the tutorial at
http://www.onlamp.com/pub/a/onlamp/2007/01/05/revi...

uses this code:
<%= link_to %Q{#{category.send(column.name)}}, :action => 'show', :id
=> category %>

what is this %Q method?
Jeff E. (Guest)
on 2007-03-27 21:25
(Received via mailing list)
nevermind... kept googling and found it:
http://www.rubycentral.com/book/language.html#UB
Philip H. (Guest)
on 2007-03-27 21:28
(Received via mailing list)
> the tutorial at
> 
http://www.onlamp.com/pub/a/onlamp/2007/01/05/revi...
>
> uses this code:
> <%= link_to %Q{#{category.send(column.name)}}, :action => 'show', :id
> => category %>
>
> what is this %Q method?

It's the same as using double quotes... but sometimes makes things
nicer... say when you want to embed a lot of double quotes in your
string
and not worry about escaping them.

irb(main):003:0> %Q{one "two" three}
=> "one \"two\" three"
This topic is locked and can not be replied to.