Can't pass parameters in routes on Rails 3

164 views
Skip to first unread message

Henrique Testa

unread,
Feb 10, 2010, 10:00:48 AM2/10/10
to rubyonra...@googlegroups.com
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 via http://www.ruby-forum.com/.

Henrique Testa

unread,
Feb 11, 2010, 6:32:47 PM2/11/10
to rubyonra...@googlegroups.com

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?

Greg Donald

unread,
Feb 11, 2010, 7:57:41 PM2/11/10
to rubyonra...@googlegroups.com
On Thu, Feb 11, 2010 at 5:32 PM, Henrique Testa <li...@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

Henrique Testa

unread,
Feb 11, 2010, 8:33:40 PM2/11/10
to rubyonra...@googlegroups.com
> 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/tickets/119-default-route-option-doesnt-work

ayupmeduck

unread,
Oct 4, 2012, 9:04:19 AM10/4/12
to rubyonra...@googlegroups.com
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 => ..."
Reply all
Reply to author
Forward
0 new messages