Quantcast
Viewing all articles
Browse latest Browse all 10

Upgrading to Rails 3: You are using the old router DSL which will be removed in Rails 3.1

You upgraded your Rails 2 application to Rails 3, you changed all the routes to match the new Rails 3 syntax, but Rails is still throwing the following deprecation message.

DEPRECATION WARNING: You are using the old router DSL which will be removed in Rails 3.1. Please check how to update your routes file at: http://www.engineyard.com/blog/2010/the-lowdown-on-routes-in-rails-3/. (called from /Users/weppos/Sites/working/simonecarletti/config/routes.rb:1)

The solution is really straightforward, just around the corner, but you need to be good enough playing “spot the difference” game. If you’re not, here’s the trick.

Make sure the #draw block at the beginning of your routes.rb file doesn’t yield any |map| parameter. In fact, this statement will cause the warning

Simonecarletti::Application.routes.draw do |map|

while this one won’t.

Simonecarletti::Application.routes.draw do

Needless to say, remove the map parameter only when you wiped out all the legacy routes. Otherwise your application won’t work at all.


Viewing all articles
Browse latest Browse all 10

Trending Articles