Forum: Ruby on Rails Rendering

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.
Mohammad (Guest)
on 2006-05-11 21:07
I want to do something like this:
<%= link_to "Attack!", :action => "attack", :id => session[:user].id,
:op_id => users.id, :update => "attk-div",:postion => "top" %>
But, What should I user link_to will redirect on click so what action do
I do?
Eric G. (Guest)
on 2006-05-11 21:19
(Received via mailing list)
Hi,
Not quite sure, but it sounds like you're trying to use a bit of ajax.
I think this is what your looking for.

<%= link_to_remote "Attack!",
  :url => {:action => "attack", :id => session[:user].id, :op_id =>
users.id},
  :update => "attk-div",
  :postion => "top"
%>

Have a read of this article. It will fill you in.
http://www.onlamp.com/pub/a/onlamp/2005/06/09/rail...

-Eric G.
ericgoodwin.com



Mohammad wrote:
> I want to do something like this:
> <%= link_to "Attack!", :action => "attack", :id => session[:user].id,
> :op_id => users.id, :update => "attk-div",:postion => "top" %>
> But, What should I user link_to will redirect on click so what action do
> I do?
>
>


--
Eric G.
http://www.ericgoodwin.com
Tom M. (Guest)
on 2006-05-11 21:37
(Received via mailing list)
Why pass something in the URL when it's already in session?

> :id => session[:user].id

As for the rest of your question you'll need to post more
detail before anyone can really help.

P.S. Save yourself headaches now, and don't store a user
      object in the session, just the user.id

--
-- Tom M.
This topic is locked and can not be replied to.