Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #4432 (closed defect: untested)

Opened 2 years ago

Last modified 2 years ago

render_component can't handle Module::Controller (with fix)

Reported by: Kevin <born70s@gmail.com> Assigned to: David
Priority: normal Milestone: 1.2
Component: ActionPack Version: 1.1.0 RC1
Severity: critical Keywords: render_component module controller
Cc: bitsweat

Description

Below statement: render_compoenent :controller => 'u/sidebar', :action => 'display_plugins'

always tried to call controller SidebarControoler instead of U::SidebarController.

I traced the root to "actionpack/lib/action_controller/components.rb" line 134 (rev 4055): request = request_for_component(klass.controller_name, options)

Above statment will eliminate the module name. I modified it to use controller_path instead of controller_name which retains module name. I'm not sure if it's an appropriate fix due to my limited knowdge of Rails core, at least it works for me: request = request_for_component(klass.controller_path, options)

Change History

04/21/06 18:50:29 changed by anonymous

This works sporadically for me. I have a Sidebar::NavigationController called using 'sidebar/navigation' which works fine, but further down the page I call another component Module::NameController using 'module/name' and I get uninitialized constant NameController problems.

06/30/06 06:56:24 changed by bitsweat

  • cc set to bitsweat.

Does it work for you on trunk? (rake rails:freeze:edge)

07/07/06 08:04:09 changed by anonymous

I didn't test with edge rails, but at least it's not fixed in v1.1.4.

07/08/06 00:23:34 changed by bitsweat

  • milestone changed from 1.1 to 1.2.

Any progress on a patch + tests?

07/22/06 17:06:56 changed by Caio Chassot <caio@v2studio.com>

  • component changed from ActiveRecord to ActionPack.

08/08/06 11:33:21 changed by anonymous

This doesn't work if there is something else with that name, this works fine for me (in edge) if you avoid name collisions.

The parents problem might be that he's lacking a slash in the beginning of the modulename. (if this is a bug? I'm note sure, I don't think it should be) (Module is a name-collision for example.)

09/25/06 06:09:30 changed by bitsweat

  • status changed from new to closed.
  • resolution set to untested.