use
match "products/category/:id/:name" => "products#index"
the :as argument is for named_routes. if you want a named_route you can
instead use
match "products/category/:id/:name" => "products#index",
:as =>
:product_category
then in your views, you can use the named route
product_category_path(''1'', ''foo'')
which will produce
products/category/1/foo
On Tue, Feb 8, 2011 at 2:54 PM, Lune Lune
<lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:
> Hi all
>
> My problem is simple :
>
> I have a link which points on :
> "products/category/#{category.id}/#{category.name}"
>
> In my route, I''d like this link calls "products/index"
BUT I want this
> URL in the browser : "products/category/#{name}"
>
> Using Rails 3 I instinctively tried :
>
> match "products/category/:id/:name", :to =>
"products#index", :as =>
> "products/category/#{name}"
>
> But the server doesn''t even run because of #{name} in :as
> I don''t know how to precise a dynamic value in :as or maybe I am
totally
> wrong.
>
>
> Thanks
>
> --
> 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-/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.
>
>
--
-------------------------------------------------------------
visit my blog at http://jimlabs.heroku.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-/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.