Updating Controller template to run with Rails 3.2.8

I am referring to a book according to which the “routes.rb” code is as
below:

================= [Code] =====================
MeBay::Application.routes.draw do |map|
map.connect ‘ads/:id’, :controller=>‘ads’, :action=>‘show’
map.connect ‘:controller/:action/:id’
map.connect ‘:controller/:action/:id.:format’
end

When I try to open this route from the browser by typing:

http://localhost:3000/ads/3

I am getting error:

=================================================
RuntimeError

You are using the old router DSL which has been 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/ or
add the rails_legacy_mapper gem to your Gemfile

What changes are needed?

See link what you get. Section Regular Routes

Use:

match ‘products/:id’, :to => ‘catalog#view’

instead

map.connect ‘ads/:id’, :controller=>‘ads’, :action=>‘show’

On 23 August 2012 08:01, Rubyist R. [email protected] wrote:

Please check how to update your routes file at:
http://www.engineyard.com/blog/2010/the-lowdown-on-routes-in-rails-3/ or
add the rails_legacy_mapper gem to your Gemfile

What changes are needed?

Did you check the link given, it looks pretty good to me? Also see
the Rails Guide on Routing, it should sort you out.

Colin

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs