I want to make four links with different arguments but the same
action.
The first time, I did it like this:
<%= link_to ''xx'' {:action => xx, :id => 0} %>
<%= link_to ''xx'' {:action => xx, :id => 1} %>
<%= link_to ''xx'' {:action => xx, :id => 2} %>
<%= link_to ''xx'' {:action => xx} %>
yes, I want the forth link with no argument.
But it didn''t work. when current url is xx/1, then the forth link
bring me to xx/1 , xx/2, xx/0 as the same.
I solve it by changing the argument name, something like
<%= link_to ''xx'' {:action => xx, :ids => 0} %>
then the url looks like xx?ids=0
everything works
Can anyone tells me more details about it ? or just where can I find
the answer.
Thanks a lot!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Yeah you are right, i have the same event like yours.
The forth link " <%= link_to ''xx'' {:action => xx}
%> " should have the
same meaning with " <%= link_to ''xx'' {:action =>
xx, :id => 0} %> ", In
this case I usually put additional params like you have done too "<%=
link_to ''xx'' {:action => xx, :ids => 0} %> ", I
have no idea how it
could be like that.
Please check, are you using render in your controller to show
destination link?
Because your link is http://localhost:3000/xx/1, when you run <%=
link_to ''xx'' {:action => xx} %>, ruby will have your
params[:id] from
your original url.
it looks like reference params[:id].
so if your url http://localhost:3000/xx/what_ever_id, the link of "<%=
link_to ''xx'' {:action => xx} %>" will be
"<%= link_to ''xx'' {:action =>
xx, :id => what_ever_id} %>", understand? you can use <%= link_to
''xx''
{:controller => yy, :action => xx} %> OR <a src="/xx">
xx </a>, i not
check it but maybe it works.
*~*~*~*~*~**~*~*~*~*~*
Reinhart Ariando
YM : Booking2Heaven
WEB : http://teapoci.blogspot.com
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Get it ! Thanks a lot !~~ On Feb 19, 10:21 am, Visit Indonesia 2008 <rails-mailing-l...@andreas- s.net> wrote:> Yeah you are right, i have the same event like yours. > > The forth link " <%= link_to ''xx'' {:action => xx} %> " should have the > same meaning with " <%= link_to ''xx'' {:action => xx, :id => 0} %> ", In > this case I usually put additional params like you have done too "<%> link_to ''xx'' {:action => xx, :ids => 0} %> ", I have no idea how it > could be like that. > > Please check, are you using render in your controller to show > destination link? > > Because your link ishttp://localhost:3000/xx/1, when you run <%> link_to ''xx'' {:action => xx} %>, ruby will have your params[:id] from > your original url. > it looks like reference params[:id]. > > so if your urlhttp://localhost:3000/xx/what_ever_id, the link of "<%> link_to ''xx'' {:action => xx} %>" will be "<%= link_to ''xx'' {:action => > xx, :id => what_ever_id} %>", understand? you can use <%= link_to ''xx'' > {:controller => yy, :action => xx} %> OR <a src="/xx"> xx </a>, i not > check it but maybe it works. > > *~*~*~*~*~**~*~*~*~*~* > Reinhart Ariando > YM : Booking2Heaven > WEB :http://teapoci.blogspot.com > > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---