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? -- Posted via http://www.ruby-forum.com/.
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/rails_ajax.html
-Eric Goodwin
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 Goodwin
http://www.ericgoodwin.com
Why pass something in the URL when it''s already in session?> :id => session[:user].idAs 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 Mornini On May 11, 2006, at 10:07 AM, 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? > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails