Hi,

I'm still battling this one and am yet unsure whether this is a bug or not.  It would be great if someone could put me out of my misery  and confirm whether this is bug or not?

With the latest testing to characterise the problem it seems to be something to do with (a) controllers a sub-directory down &/or (b) url_for usage in a layout perhaps.  That is in the sense that I have a "url_for" which resolves find when the context is one controller but throws an error when in the context of another. 

Key points include:
  1. routes.rb routes a URL to a controller which is down 1 subdirectory - Example
      map.connect ':locale/mygoodness', :controller => 'highlevel/midlevel', :action ="" 'testaction', :defaults => {:locale => nil}
      map.connect ':locale/contactbackdoor', :controller => "contacts", :defaults => {:locale => nil}
  2. controller picks this up ok
    class Highlevel::MidlevelController < ApplicationController
      def testaction
        puts "Highlevel::MidlevelController - testaction"
      end
    end
  3. the "views/highlevel/midlevel/testaction.rhtml" view is small as the application.rb has a layout "site_layout" line.
  4. The "site_layout" has
             <%= link_to "2-contacts ", :controller => 'contacts' %>
  5. The site_layout link is generator OK when it is used from the opening page, BUT when it is utilised after a URL has come in via the controller which is down a sub-directory ( i.e. 'highlevel/midlevel) an error is encountered.  See below.
    1. Note the hash indicated in the error below has ":controller=>" highlevel/contacts" and it has seemed to munge the "highlevel/midlevel" controller name with the "contacts" controller name.
    2. Interestingly if I change the "url_for" line in the layout to: 

      •  <%= link_to "2-contacts ", :controller => nil %> one sees the following in the error :controller=>" highlevel/highlevel/midlevel"

      • <%= link_to "2-contacts ", :controller => "" %> one sees the following in the error
        :controller=>"highlevel/"
===============================================

ActionController::RoutingError in Highlevel/midlevel#testaction

Showing app/views/layouts/site_layout.rhtml where line #15 raised:

No url can be generated for the hash {:action="" :controller=>"highlevel/contacts"}


Extracted source (around line #15):

12:     
13: <p> <%= link_to "1 " %> </p>
14:
15: <p> <%= link_to "2-contacts ", :controller => 'contacts' %> </p>
16:
17: <p> <%#= link_to "Plugin Login", {:controller => '/rbac/login', :action ="" 'login'} %></p>
18:

RAILS_ROOT: ./script/../config/..

Application Trace | Framework Trace | Full Trace
generated_code/routing/generation.rb:65:in `generate_default_path'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/routing.rb:473:in `generate_path'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack- 1.12.5/lib/action_controller/routing.rb:469:in `generate'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/url_rewriter.rb:44:in `rewrite_path'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack- 1.12.5/lib/action_controller/url_rewriter.rb:11:in `rewrite'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:488:in `url_for'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack- 1.12.5/lib/action_view/helpers/url_helper.rb:27:in `url_for'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/helpers/url_helper.rb:59:in `link_to'
#{RAILS_ROOT}/app/views/layouts/site_layout.rhtml:15:in `_run_rhtml_layouts_site_layout'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:316:in `compile_and_render_template'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:292:in `render_template'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:251:in `render_file'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/layout.rb:251:in `render_without_benchmark'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:53:in `render'
C:/InstantRails/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack- 1.12.5/lib/action_controller/benchmarking.rb:53:in `render'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:942:in `perform_action_without_filters'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack- 1.12.5/lib/action_controller/filters.rb:368:in `perform_action_without_benchmark'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue'
C:/InstantRails/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack- 1.12.5/lib/action_controller/rescue.rb:82:in `perform_action'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:408:in `process_without_filters'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack- 1.12.5/lib/action_controller/filters.rb:377:in `process_without_session_management_support'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/session_management.rb:117:in `process'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/dispatcher.rb:38:in `dispatch'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/webrick_server.rb:115:in `handle_dispatch'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails- 1.1.6/lib/webrick_server.rb:81:in `service'
C:/InstantRails/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
C:/InstantRails/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
C:/InstantRails/ruby/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
C:/InstantRails/ruby/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
C:/InstantRails/ruby/lib/ruby/1.8/webrick/server.rb:95:in `start'
C:/InstantRails/ruby/lib/ruby/1.8/webrick/server.rb:92:in `start'
C:/InstantRails/ruby/lib/ruby/1.8/webrick/server.rb:23:in `start'
C:/InstantRails/ruby/lib/ruby/1.8/webrick/server.rb:82:in `start'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/webrick_server.rb:67:in `dispatch'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails- 1.1.6/lib/commands/servers/webrick.rb:59
C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in `require'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/commands/server.rb:30
C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport- 1.3.1/lib/active_support/dependencies.rb:147:in `require'
script/server:3
============================================
-e:4

Request

Parameters: {"locale"=>"en"}

Show session dump

Response

Headers: {"Status"=>"200 OK", "cookie"=>[], "Cache-Control"=>"no-cache"}






--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/rubyonrails-core
-~----------~----~----~----~------~----~------~--~---

Reply via email to