views:

666

answers:

3

Hi All,

What is the most straightforward mechanism by which to "link_to_remote" and popout a window with the data? I need "link_to_remote" because I need to pass certain data along with the url without redoing my routes. If this would be better served by a "link_to" without the need to redo my routes, I'm all for it. I simply can't get it to work, atm.

Thoughts?

A: 

link_to_remote is used to do XHR requests, so you cannot use it to open a popup window with the response.

You don't need to redo your route anyway, because I assume that if you want to use link_to* to get some data, then you have your controller/action pair defined and accessible already.

Also, usually, Rails applications have the catch all route enabled to match :controller/:action. If that's your case, then you can use link_to that controller/action to get the data.

aurelian
Well, all the calculations occur in a non-standard/non-restful action "view_chart" based on an item's data. In any case, how would you recommend I go about it? link_to "popup" doesn't seem to be working atm. I'll give it another try.
humble_coder
A: 

What window do u mean ? modal window ? if u want to show some data through modal window, then i suggest u to use http://prototype-window.xilinus.com/index.html, it easier to use, just write some js function and create link_to_function in rails helper/view to call the js function.

gkrdvl
+1  A: 

Perhaps you're looking for something like:

<%= link_to_function "Show Article in Popout window",
      "window.open(#{article_path(article).to_json}, 'show_article')" %>
Duncan Beevers
Nice. Thanks for that.
humble_coder