Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

rake routes gives different results (rails 3.0.0.rc1, rails 3.0.0.rc2)

#5573

OS : Ubuntu 10.04

Using rvm with 2 gemsets (rails 3.0.0.rc1 and 3.0.0.rc2)
given the following config/initializers/inflections.rb and config/routes.rb

ActiveSupport::Inflector.inflections do |inflect|
inflect.irregular 'export','exports' end
MyApp::Application.routes.draw do
root :to => 'user_sessions#new'
resources :export do
collection do
get :db
get :audit
end
end
end

In one of my views I am using

<%= link_to "Offline-export", db_exports_url %>

When doing the following (my rails application is located in ~/rails/myapp)

$ cd rails/myapp

$ rvm use 1.9.2@rails3rc1

$ rake routes | grep db

db_exports GET /export/db(.:format) {:controller=>"export", :action=>"db"}

All my tests passes


$ rvm use 1.9.2@rails3rc2

$ rake routes | grep db

db_export_index GET /export/db(.:format) {:controller=>"export", :action=>"db"}

Some of my tests fail, especially complaining

undefined local variable or method db_exports_url' for #<#<Class:0x89b6240>:0x91d8e3c> (ActionView::Template::Error)

Reported by gummybears · September 7th, 2010 @ 05:44 PM

State: invalid
Milestone: none
Assigned to: nobody
Importance: Low

Activity

  1. Andrew White
    Andrew White
    • Importance changed from to Low

    In rc1 the resource name was forced to be a plural but since this broke some peoples apps starting from rc2 we assume that you pass the plural in the resources call (similarly a resource call assumes a singular). Since you pass in export to the resources call the singular name matches the resource name and it thinks the resource is uncountable and appends _index to the index route.

    If you update to the 3.0.0 final release and change your routes to this then it should work:

      resources :exports do
        collection do
          get :db
          get :audit
        end
      end
    

    You shouldn't need the export custom inflection.

    September 8th, 2010 @ 07:29 AM

  2. Andrew White
    Andrew White
    • State changed from new to invalid

    September 8th, 2010 @ 07:29 AM