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?
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.
-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
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.