Forum: Ruby on Rails Can't pass parameters in routes on Rails 3

Posted by Henrique Testa (hgtesta)
on 2010-02-10 16:00
Hi all!

In Rails 2.3, I could do the following:

map.connect "/posts/favorites", :controller => :posts, :action =>
":index", :filter => "favorites"

But it seems that the "match" command in Rails 3 doesn't accept
parameters. So, the following doesn't work:

match "/posts/favorites" => "posts#index", :filter => "favorites"

Is there any way to pass a parameter in route like in 2.3 ?

Thank you!
Posted by Henrique Testa (hgtesta)
on 2010-02-12 00:32
Sorry to ask again, but no one know how to do this? I have read all the 
routes section in Rails Guides ( http://guides.rails.info/routing.html ) 
but didn't find a way to pass parameters in routes.

Maybe this feature was removed from Rails 3?
Posted by Greg Donald (destiney)
on 2010-02-12 01:59
(Received via mailing list)
On Thu, Feb 11, 2010 at 5:32 PM, Henrique Testa <lists@ruby-forum.com> 
wrote:
> Sorry to ask again, but no one know how to do this? I have read all the
> routes section in Rails Guides ( http://guides.rails.info/routing.html )
> but didn't find a way to pass parameters in routes.
>
> Maybe this feature was removed from Rails 3?

I'd file a bug report.. if it's missing on purpose they will surely tell 
you.


--
Greg Donald
destiney.com | gregdonald.com
Posted by Henrique Testa (hgtesta)
on 2010-02-12 02:33
> I'd file a bug report.. if it's missing on purpose they will surely tell 
> you.

Just discovered a way, using :default => { :filter =>"favorites" }

Unfortunately, it doesn't work :) But it is on Rails Guides. I just 
filled a bug report here 
https://rails.lighthouseapp.com/projects/16213/tic...
Posted by ayupmeduck (Guest)
on 2012-10-04 15:05
(Received via mailing list)
This has been around for a long time, but just in case somebody stumbles
across it like I did, it should be ":defaults => ..." not "default => 
..."
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.