Deprecation warning with rails 2.3.4

5 views
Skip to first unread message

tomtt

unread,
Sep 7, 2009, 5:31:20 AM9/7/09
to resources_controller
After trying to upgrade a project to rails 2.3.4 to fix the serious
XSS security issue (http://groups.google.com/group/rubyonrails-
security/msg/7f57cd7794e1d1b4), resources_controller generates a lot
of deprecation warnings. Like so:

DEPRECATION WARNING: routes_for_controller_and_action() has been
deprecated. Please use routes_for(). (called from
routes_for_controller_and_action at /Users/tomtt/created/projects/foo/
vendor/rails/actionpack/lib/action_controller/routing/route_set.rb:
473)

The reason is
that ::ActionController::Routing::Routes.routes_for_controller_and_action
was deprecated in this release. They thought it was alright to pull
this method from the public api because it is not used internally.
https://rails.lighthouseapp.com/projects/8994/tickets/3023

I have tried adding 2-3-stable to garlic, but I get 637 examples, 470
failures (other versions are fine), even though we have been
successfully using RC with 2-3-stable on our project for a while now.
So this keeps me from authoring a patch myself for now.

A workaround seems to be to just get all routes
using ::ActionController::Routing::Routes.routes instead
of ::ActionController::Routing::Routes.routes_for_controller_and_action,
but I am aware that getting all the routes may have performance
implications.

The deprecation warning suggests using routes_for but that method is
not documented at all and does not accept the controller and action as
arguments so I think this is a Red Herring.

I was hoping somebody more experienced with RC could have a look at
this...

Tom.

Ian White

unread,
Sep 7, 2009, 5:34:32 AM9/7/09
to resources_...@googlegroups.com
Hi Tom,

I'll look into it tonight.

Thanks for the heads up!

Cheers,
Ian

Ian White

unread,
Sep 11, 2009, 3:45:36 PM9/11/09
to resources_controller
Hi Tom,

Looking into this, I;ve found that the 'routes_for' method that is to
be used instead doesn;t work at all - it references some local vars
that are not in scope, so I reckon that it's implementation isn't
finished. I've added a comment to the ticket, and if that isn't
picked up I'll open a ticket.

In the meantime I'll look into a workaround.

Cheers,
Ian

Ian White

unread,
Sep 14, 2009, 8:25:44 AM9/14/09
to resources_controller
FYI, the problem running specs on 2.3 is because of a bug in rails 2.3
detailed here:
https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/3198-nested-resource-routes-not-generated-correctly-rails-23

Cheers,
Ian

Chris Hapgood

unread,
Sep 14, 2009, 10:55:38 AM9/14/09
to resources_...@googlegroups.com
Yikes!

Ian White

unread,
Sep 18, 2009, 1:28:16 PM9/18/09
to resources_controller
FYI, RC is now going green an all 2.x railses, I had to frig around
with route definition order to get it all going on Rails 2.3 (because
it has Rails 3 semantics for routes by default, and those semantics
are more fussy than 2.x).

I have also made RC less fussy about what route the controller is
invoked with, which is aimed at the :as option in routes.

Next: rewrite for Rails 3, using the plugin API. It probably wont be
BC, but since most stuff is going to break on Rails 3, I figure that's
not a particularly bad thing. So if there's any major grips with RC,
post em, and I'll take these into account with the rewrite.

On the deprecation warning issue - it's not resolved yet, but this is
because of an issue with Rails 2.3 that is currently being worked on
here: https://rails.lighthouseapp.com/projects/8994/tickets/3231-routes_for-method-doesnt-work-at-all

Cheers,
Ian

Ian White

unread,
Sep 19, 2009, 3:39:52 PM9/19/09
to resources_controller
The deprecation warning issue is fixed now. See next announcement for
details.

Cheers,
Ian
Reply all
Reply to author
Forward
0 new messages