I am trying to pass 2 parameters to the ''new'' action in the plans_controller, something like this. "new_plan_path+"?id1=1&id2=3" Only ''id1'' is passed and the "&" symbol is rewritten as ''&'', hence ''id2'' is not received using params[:id2] in new method. Somebody suggest an alternate please... Thanks in advance. -- 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 -~----------~----~----~----~------~----~------~--~---
Vidya Ramachandren wrote:> "new_plan_path+"?id1=1&id2=3" > > Only ''id1'' is passed and the "&" symbol is rewritten as ''&'', hence > ''id2'' is not received using params[:id2] in new method.Use something like: <%= link_to ''New plan'', url_for(:action => :new, :id1 => 2, :id2 => 3) %> This will create the tag: <a href="/plans/new?id1=2&id2=3">New plan</a> And the #new action will see both params[:id1] and params[:id2] -- 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 -~----------~----~----~----~------~----~------~--~---
Mark Bush wrote:> Use something like: > > <%= link_to ''New plan'', url_for(:action => :new, :id1 => 2, :id2 => 3) > %>Actually, this is better as: <%= link_to ''New plan'', new_plan_path(:id1 => 2, :id2 => 3) %> -- 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 -~----------~----~----~----~------~----~------~--~---
Still I am getting nil value for the id2 :( Mark Bush wrote:> Mark Bush wrote: >> Use something like: >> >> <%= link_to ''New plan'', url_for(:action => :new, :id1 => 2, :id2 => 3) >> %> > > Actually, this is better as: > > <%= link_to ''New plan'', new_plan_path(:id1 => 2, :id2 => 3) %>-- 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 -~----------~----~----~----~------~----~------~--~---
Vidya Ramachandren wrote:> Still I am getting nil value for the id2 :(I''ve checked this against Safari, Firefox and IE and all pass the params correctly. (This is with Rails 2, but that shouldn''t matter.) Can you look at the web page source with the link on it and post the link text and also the parameters from your log file from selecting the link? -- 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 -~----------~----~----~----~------~----~------~--~---
Hi Try this link_to("abcabcabd", :controller=>''controller'', :action=>''action'', :id=> 123, :show=>"true") it will create a link something like : <a href="controller/action/123?show=true">abcabc</a> on next page<%= params[:id]%> will be equal to 123 and <%params[:show]%> equal to true i hope it will help Ajit On Mar 10, 8:39 am, Vidya Ramachandren <rails-mailing-l...@andreas- s.net> wrote:> I am trying to pass 2 parameters to the ''new'' action in the > plans_controller, something like this. > > "new_plan_path+"?id1=1&id2=3" > > Only ''id1'' is passed and the "&" symbol is rewritten as ''&'', hence > ''id2'' is not received using params[:id2] in new method. > > Somebody suggest an alternate please... > > Thanks in advance. > -- > 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---