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.

:as makes resources_controller go crazy :)

#3

hey

when using :as in the routes, things break in resources_controller...

i have a route like this defined:


map.resources :chairs, :as => 'education' do |chairs|
    chairs.resources :publications, :collection => {:order => :put}
    chairs.resources :staffs, :as => 'staff'
end

this causes 2 bugs...

the first, publications doesn't get recognized: ....can't match the route to the resource specification...

second bug, causes the order action to fail saying: NameError (uninitialized constant Element):

this is the last part of the log:


vendor/rails/activesupport/lib/active_support/dependencies.rb:443:in `load_missing_constant'
vendor/rails/activesupport/lib/active_support/dependencies.rb:80:in `const_missing'
vendor/rails/activesupport/lib/active_support/dependencies.rb:92:in `const_missing'
vendor/rails/activesupport/lib/active_support/inflector.rb:361:in `constantize'
vendor/rails/activesupport/lib/active_support/inflector.rb:360:in `each'
vendor/rails/activesupport/lib/active_support/inflector.rb:360:in `constantize'
vendor/rails/activesupport/lib/active_support/core_ext/string/inflections.rb:162:in `constantize'
vendor/plugins/resources_controller/lib/ardes/resources_controller/specification.rb:51:in `initialize'
vendor/plugins/resources_controller/lib/ardes/resources_controller/specification.rb:21:in `new'
vendor/plugins/resources_controller/lib/ardes/resources_controller/specification.rb:21:in `new'
vendor/plugins/resources_controller/lib/ardes/resources_controller.rb:763:in `load_wildcard'
vendor/plugins/resources_controller/lib/ardes/resources_controller.rb:784:in `load_wildcards_from'
vendor/plugins/resources_controller/lib/ardes/resources_controller.rb:784:in `times'
vendor/plugins/resources_controller/lib/ardes/resources_controller.rb:784:in `load_wildcards_from'
vendor/plugins/resources_controller/lib/ardes/resources_controller.rb:745:in `load_enclosing_resources'

let me know if it isn't clear enough :)

Reported by humancopy · April 23rd, 2009 @ 05:56 AM

State: accepted
Milestone: none
Assigned to: Ian White Ian White

Activity

  1. Nilbus
    Nilbus

    I also have this issue. This prevents me from using the plugin at all, since my main model uses :as.

    July 18th, 2009 @ 11:26 PM

  2. Ian White
    Ian White

    Thanks for the ticket.

    I should be able work on this in the coming week

    July 21st, 2009 @ 12:06 PM

  3. Ian White
    Ian White
    • State changed from new to accepted

    Just tried :as out on a rails 2.2 project and everything worked fine with a nested resource.

    I'll get a test case up and run it against all the the 2.x versions, but could you tell me what version of rails you;re using?

    July 21st, 2009 @ 01:21 PM

  4. Nilbus
    Nilbus

    I'm on 2.3.2

    Thanks for looking into it

    July 21st, 2009 @ 01:41 PM

  5. Ian White
    Ian White

    What happens if you do this (in the latest version of RC)

    resources_controller_for :chair, :segment => 'education'

    September 29th, 2009 @ 03:12 PM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.