Hello, I''m still really new to Ruby on Rails and I just need some clarification... So if I define a param in a link_to in my view like so: <%= link_to match[''name''], :controller => ''compare'', :action => ''viewinfo'', :param1 => match[''name''], :param2 => match[''number''] %> How do I call param1 and param2 once in the controller? I''m trying to do something like this: if param1 != nil && param2 != nil However, just saying ''param1'' and ''param2'' doesn''t work because it is an undefined local variable... How can I use them as such? Thank you!! - Jeff -- 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 -~----------~----~----~----~------~----~------~--~---
On Feb 13, 2008, at 6:32 PM, Jeff Miller wrote:> Hello, > I''m still really new to Ruby on Rails and I just need some > clarification... So if I define a param in a link_to in my view like > so: > > <%= link_to match[''name''], :controller => ''compare'', :action => > ''viewinfo'', :param1 => match[''name''], :param2 => match[''number''] %> > > How do I call param1 and param2 once in the controller? I''m trying > to do > something like this: > > if param1 != nil && param2 != nil > > However, just saying ''param1'' and ''param2'' doesn''t work because it > is an > undefined local variable... How can I use them as such? > > Thank you!! > - JeffTry: if params[:param1] && params[:param2] no need to add the ''!= nil'' since only nil and false are not "true". If you''re that new, you need to spend a bit of time learning Ruby itself since all your code will be ruby code written with Rails conventions. -Rob Rob Biedenharn http://agileconsultingllc.com Rob-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thank you! I got it. Thanks for the suggestion, I will definitely do that. -- 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 -~----------~----~----~----~------~----~------~--~---