Is there a way to make a mathing routing command with an optional parameter? match "blah/:param1" => "balh#show" if I want param1 to be optional, how would i go about doing that? it seems like you can make another match line without the param1 part as below but was hoping to find another way to do it. match "blah" => "blah#show" -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Jun 28, 2011, at 10:07 AM, tashfeen.ekram wrote:> Is there a way to make a mathing routing command with an optional > parameter? > > match "blah/:param1" => "balh#show"match "blah(/:param1)" => "blah#show" -philip> if I want param1 to be optional, how would i go about doing that? > > it seems like you can make another match line without the param1 part > as below but was hoping to find another way to do it. > > match "blah" => "blah#show" > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Thanks! That helps a lot! On Jun 28, 1:29 pm, Philip Hallstrom <phi...-LSG90OXdqQE@public.gmane.org> wrote:> On Jun 28, 2011, at 10:07 AM, tashfeen.ekram wrote: > > > Is there a way to make a mathing routing command with an optional > > parameter? > > > match "blah/:param1" => "balh#show" > > match "blah(/:param1)" => "blah#show" > > -philip > > > > > if I want param1 to be optional, how would i go about doing that? > > > it seems like you can make another match line without the param1 part > > as below but was hoping to find another way to do it. > > > match "blah" => "blah#show" > > > -- > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.