This project is archived and is in readonly mode.

#5573 ✓invalid
gummybears

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

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

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)

Comments and changes to this ticket

  • Andrew White

    Andrew White September 8th, 2010 @ 07:29 AM

    • 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.

  • Andrew White

    Andrew White September 8th, 2010 @ 07:29 AM

    • State changed from “new” to “invalid”

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Pages