jpw
jpw

Reputation: 19257

rails 3, in link_to how specify target AND optional url params?

I got extra url params working fine with my link_to , but cannot figure out how to make the link open into a a new window or tab

I tried :target => "_blank" in several places, but it always throws a syntax error

here's what I have before specifying a target:

= link_to "click here", :controller=>"widget", :action=>"mypage", :extraparam => "foobar"

Upvotes: 14

Views: 12602

Answers (1)

Chris Cherry
Chris Cherry

Reputation: 28574

Try this:

link_to "click here", { :controller=>"widget", :action=>"mypage", :extraparam => "foobar" }, :target => "_blank"

Upvotes: 32

Related Questions