List Info

Thread: bug in routes ???




bug in routes ???
user name
2006-09-21 09:39:53
[I had posted to the normal talk mailing list but subsequently thought it perhaps should have been posted here?]

Hi,

Is this a bug in routes.rb, or something I'm doing wrong.  Basically from what I can tell the url_for being generated in the case where my existing controller had a forward slash (i.e. active_rbac/login) may be causing a problem.   I'm creating a link to a different controller however the URL created has a piece of the previous controller in it (i.e. active_rbac/).  I put a breakpoint in the view and the run the following to confirm, see below.  Also note the login aspects use a plugin.

Is this a bug?

============== debug / irb =========================
irb(#&lt;#<Class:0x39bea80>:0x39bea50>):051:0* params
=&gt; {"action"=&gt;"login", "controller";=>";active_rbac/login&quot;, "locale"=&gt;"en&quot;}

irb(#<#<;Class:0x39bea80>:0x39bea50>;):052:0>; session[:locale]
=>; "en&quot;

irb(#<#<Class:0x39bea80>:0x39bea50>):053:0> url_for
=&gt; "/en/active_rbac/login/login"

irb(#<#&lt;Class:0x39bea80>:0x39bea50&gt;):054:0&gt; url_for :locale => "fr&quot;
=> "/fr/active_rbac/login";

irb(#<;#<Class:0x39bea80&gt;:0x39bea50>):055:0> url_for :locale => "fr&quot;, :controller => "splash"
=> "/fr/active_rbac/splash&quot; &nbsp;   ; <== PROBLEM HERE, I expect to see "/fr/splash";

irb(#<#<Class:0x39bea80>:0x39bea50>):056:0>

====================
ActionController::Routing::Routes.draw do |map|

&nbsp; &nbsp; map.connect '/admin/group/:action/:id', :controller => 'active_rbac/group'
  ;  map.connect '/admin/role/:action/:id', :controller => 'active_rbac/role'
&nbsp; &nbsp; map.connect '/admin/static_permission/:action/:id', :controller => 'active_rbac/static_permission'
  ;  map.connect '/admin/user/:action/:id', :controller => 'active_rbac/user'

 &nbsp;  map.connect '/login/:en', :controller => 'active_rbac/login', :action => 'login'
 &nbsp; 
 &nbsp;  map.connect '/logout', :controller => 'active_rbac/login',:action => 'logout'
  ;  map.connect '/register/confirm/:user/:token', :controller => 'active_rbac/registration', :action => 'confirm'
  ;  map.connect '/register/:action/:id', :controller => 'active_rbac/registration'

 &nbsp;  map.splash ':locale', :controller => 'splash', :locale => nil, :defaults => { :locale => "en&quot; }
 &nbsp;  map.connect ':locale/:controller/:action/:id',
 &nbsp; &nbsp;  :defaults => { :locale => "en&quot;, :controller => "splash" }

end
====================

Thanks
Greg


--~--~---------~--~----~------------~-------~--~----~
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 rubyonrails-coregooglegroups.com
To unsubscribe from this group, send email to rubyonrails-core-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-core
-~----------~----~----~----~------~----~------~--~---

bug in routes ???
user name
2006-09-21 12:09:04
2006/9/21, Greg Hauptmann <greg.hauptmann.rubygmail.com>:
> Is this a bug?

You gave url_for a relative path, so it does what is
expected: a
relative path construction.  What happens if you use an
absolute path
?

Bye !
-- 
François Beausoleil
http://blog.teksol.info/
http://piston.rubyforge.
org/

--~--~---------~--~----~------------~-------~--~----~
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 rubyonrails-coregooglegroups.com
To unsubscribe from this group, send email to
rubyonrails-core-unsubscribegooglegroups.com
For more options, visit this group at http:
//groups.google.com/group/rubyonrails-core
-~----------~----~----~----~------~----~------~--~---

bug in routes ???
user name
2006-09-21 19:26:20
Hi,

I tried passing a controller string of "/contacts" instead of "contacts&quot; and this does work (thanks) however I don't quite understand the logic around this relative path behaviour in routes.rb.

* If the controller itself is contacts_controller.rb and it is in the root (i.e. not a subdirectory) why would one be required to specify "/&quot;

* Conversely what is gained by allowing specification of a relative controller, or more to the point, if one is specified as was the case here what is the logic behind allowing a URL to be greated by routes.rb that does not match a route?&nbsp;  Shouldn't the URL producing mechanism in routes.rb be matching the input parameters against available routes, such invalid URLs are not produced (i.e .&nbsp; one that doesn't match a route)?


====================================
irb(#&lt;#<Class:0x3775b58>:0x3775b28>):021:0* url_for :controller => "/contacts "
=&gt; "/en/contacts"

irb(#<#&lt;Class:0x3775b58>:0x3775b28&gt;):022:0&gt; url_for :controller => "contacts "
=>; "/en/active_rbac/contacts"

irb(#<#<Class:0x3775b58>;:0x3775b28>):023:0> params
=&gt; {"action"=&gt;"login", "controller";=>";active_rbac/login&quot;, "locale"=&gt;"en&quot;}

irb(#<#<;Class:0x3775b58>:0x3775b28>;):024:0>; url_for
=&gt; "/en/active_rbac/login/login"

====================================

Tks


--~--~---------~--~----~------------~-------~--~----~
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 rubyonrails-coregooglegroups.com
To unsubscribe from this group, send email to rubyonrails-core-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-core
-~----------~----~----~----~------~----~------~--~---

bug in routes ???
user name
2006-09-21 20:28:17
PS. In fact using the "/&quot; in the url_for (e.g. url_for :controller => "/contacts ") still seems to be an issue as rails doesn't resolve it.  As an example:

===========routes.rb extract=================
 &nbsp;  map.connect '/login/:en', :controller => 'active_rbac/login', :action => 'login'
&nbsp;   map.splash ':locale', :controller => 'splash', :locale => nil
 &nbsp;  map.connect ':locale/:controller/:action/:id', :defaults => { :controller => "splash" }

==========manual debug====================
irb(#<#<Class:0x38cd400>:0x38cd3d0>):005:0* params
=&gt; {"action"=&gt;"login", "controller";=>";active_rbac/login&quot;, "locale"=&gt;"fr&quot;}

irb(#<#&lt;Class:0x38cd400>:0x38cd3d0&gt;):006:0&gt; url_for
=> "/fr/active_rbac/login/login"

irb(#<#<;Class:0x38cd400>:0x38cd3d0>;):007:0>; url_for :controller => ' contacts', :action => 'list'
=&gt; "/fr/active_rbac/contacts/list"&nbsp; &nbsp;  <== NOT DESIRED URL, WILL NOT WORK, "active_rbac&quot; should not appear

irb(#<#&lt;Class:0x38cd400>:0x38cd3d0&gt;):008:0&gt; url_for :controller => '/contacts', :action => 'list'
ActionController::RoutingError: No url can be generated for the hash {:action=&gt;"list", :controller=>";contacts&quot;}
&nbsp; &nbsp; &nbsp; &nbsp; from (druby://localhost:42531) generated_code/routing/generation.rb:198:in `generate_default_path'
 &nbsp;   ; &nbsp; from (druby://localhost:42531) C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/routing.rb:473:in `generate_path'
 ; &nbsp; &nbsp; &nbsp; from (druby://localhost:42531) C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack- 1.12.5/lib/action_controller/routing.rb:469:in `generate'
 &nbsp; &nbsp; &nbsp;  from (druby://localhost:42531) C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/url_rewriter.rb:44:in `rewrite_path'
 ; &nbsp; &nbsp; &nbsp; from (druby://localhost:42531) C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/url_rewriter.rb:11:in `rewrite'
  ; &nbsp; &nbsp;  from (druby://localhost:42531) C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack- 1.12.5/lib/action_controller/base.rb:488:in `url_for'
  ; &nbsp; &nbsp;  from (druby://localhost:42531) C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/helpers/url_helper.rb:27:in `url_for'
  ; &nbsp; &nbsp;  from (druby://localhost:42531) (irb):8:in `breakpoint'
 &nbsp;   ; &nbsp; from (druby://localhost:42531) C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/breakpoint.rb:512:in `breakpoint'
 &nbsp; &nbsp;   ; from (druby://localhost:42531) C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails- 1.1.6/lib/breakpoint.rb:512:in `breakpoint'
 &nbsp; &nbsp;   ; from (druby://localhost:42531) ./script/../config/../app/views/layouts/site_layout.rhtml:38:in `_run_rhtml_layouts_site_layout'
 &nbsp; &nbsp; &nbsp;  from (druby://localhost:42531) C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack- 1.12.5/lib/action_view/base.rb:316:in `compile_and_render_template'
&nbsp; &nbsp;   ;  from (druby://localhost:42531) C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:292:in `render_template'
&nbsp; &nbsp;   ;  from (druby://localhost:42531) C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:251:in `render_file'
 &nbsp;   ; &nbsp; from (druby://localhost:42531) ./script/../config/../config/nested_layout.rb:7:in `inside_layout'
&nbsp; &nbsp; &nbsp; &nbsp; from (druby://localhost:42531) ./script/../config/../app/views/layouts/login_layout.rhtml:9:in `_run_rhtml_layouts_login_layout'... 49 levels...
  ; &nbsp; &nbsp;  from C:/InstantRails/ruby/lib/ruby/1.8/drb/drb.rb:1512:in `perform'
 &nbsp; &nbsp; &nbsp;  from C:/InstantRails/ruby/lib/ruby/1.8/drb/drb.rb:1586:in `main_loop'
 &nbsp; &nbsp; &nbsp;  from C:/InstantRails/ruby/lib/ruby/1.8/drb/drb.rb:1582:in `main_loop'
 &nbsp; &nbsp; &nbsp;  from C:/InstantRails/ruby/lib/ruby/1.8/drb/drb.rb:1578:in `main_loop'
 &nbsp; &nbsp;   ; from C:/InstantRails/ruby/lib/ruby/1.8/drb/drb.rb:1427:in `run'
&nbsp; &nbsp; &nbsp; &nbsp; from C:/InstantRails/ruby/lib/ruby/1.8/drb/drb.rb:1424:in `run'
&nbsp; &nbsp; &nbsp; &nbsp; from C:/InstantRails/ruby/lib/ruby/1.8/drb/drb.rb:1344:in `initialize'
 &nbsp;   ; &nbsp; from C:/InstantRails/ruby/lib/ruby/1.8/drb/drb.rb:1624:in `start_service'
 ; &nbsp; &nbsp; &nbsp; from C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/breakpoint_client.rb:146
&nbsp; &nbsp;   ;  from C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails- 1.1.6/lib/breakpoint_client.rb:145
&nbsp;   ; &nbsp;  from C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require'
  ; &nbsp; &nbsp;  from C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in `require'
 &nbsp; &nbsp; &nbsp;  from C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/commands/breakpointer.rb:1
  ; &nbsp; &nbsp;  from C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require'
  ; &nbsp; &nbsp;  from C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport- 1.3.1/lib/active_support/dependencies.rb:147:in `require'
  ; &nbsp; &nbsp;  from script/breakpointer:3irb(#<#&lt;Class:0x38cd400>:0x38cd3d0&gt;):009:0&gt;

=================================================





--~--~---------~--~----~------------~-------~--~----~
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 rubyonrails-coregooglegroups.com
To unsubscribe from this group, send email to rubyonrails-core-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-core
-~----------~----~----~----~------~----~------~--~---

bug in routes ???
user name
2006-09-23 11:57:53
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&nbsp; 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.&nbsp; That is in the sense that I have a "url_for&quot; which resolves find when the context is one controller but throws an error when in the context of another.&nbsp;

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}
    &nbsp; map.connect ':locale/contactbackdoor', :controller => "contacts", :defaults => {:locale => nil}
  2. controller picks this up ok
    class Highlevel::MidlevelController < ApplicationController
      def testaction
     &nbsp;  puts "Highlevel::MidlevelController - testaction"
      end
    end
  3. the "views/highlevel/midlevel/testaction.rhtml&quot; view is small as the application.rb has a layout "site_layout&quot; line.
  4. The "site_layout&quot; has
     ; &nbsp; &nbsp; &nbsp;  <%= 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=&gt;" highlevel/contacts&quot; 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=>&quot; highlevel/highlevel/midlevel&quot;

      • &lt;%= link_to "2-contacts ", :controller => "&quot; %> one sees the following in the error
        :controller=>&quot;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=&gt;"index", :controller=>";highlevel/contacts&quot;}

Extracted source (around line #15):

12:     
13: <p> <%= link_to "1 " %> </p>
14:
15: <p> <%= link_to "2-contacts ", :controller => 'contacts' %> </p&gt;
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"=&gt;"en"}

Show session dump

Response

Headers: {"Status"=&gt;"200 OK", "cookie"=&gt;[], "Cache-Control&quot;=>&quot;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 rubyonrails-coregooglegroups.com
To unsubscribe from this group, send email to rubyonrails-core-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-core
-~----------~----~----~----~------~----~------~--~---

bug in routes ???
user name
2006-09-23 22:52:02
> 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.

If you want your url_for calls to work from both the top
level, and
controllers in modules,  you need to use:

:controller=>'/the_controller'

Otherwise it assumes it's a relative link and generates
links
accordingly.   Another (simpler) option is just to use a
named route.



-- 
Cheers

Koz

--~--~---------~--~----~------------~-------~--~----~
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 rubyonrails-coregooglegroups.com
To unsubscribe from this group, send email to
rubyonrails-core-unsubscribegooglegroups.com
For more options, visit this group at http:
//groups.google.com/group/rubyonrails-core
-~----------~----~----~----~------~----~------~--~---

bug in routes ???
user name
2006-09-23 23:49:15
creating subdirectories inside the controller directory is just gonna create problem some time or another. I'm not surprise to see this problem.

On 9/24/06, Michael Koziarski <koziarski.com">michaelkoziarski.com> wrote:

> Hi,
>
&gt; 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&nbsp; and confirm
&gt; 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.&nbsp; 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.

If you want your url_for calls to work from both the top level, and
controllers in modules,&nbsp; you need to use:

:controller=&gt;'/the_controller'

Otherwise it assumes it's a relative link and generates links
accordingly.&nbsp;  Another (simpler) option is just to use a named route.



--
Cheers

Koz

gcc -O0 &nbsp;-DRUBY_EXPORT&nbsp;  -rdynamic -Wl,-export-dynamic -L. &nbsp; main.o&nbsp; -lruby-static -ldl -lcrypt -lm &nbsp; -o ruby
Everyone is trying their hardest to do their job but management has set it up so that it's impossible.
Take the control over your money, track your expenses http://justbudget.com

Mathieu
--~--~---------~--~----~------------~-------~--~----~
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 rubyonrails-coregooglegroups.com
To unsubscribe from this group, send email to rubyonrails-core-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-core
-~----------~----~----~----~------~----~------~--~---

bug in routes ???
user name
2006-09-24 00:09:22
I'm still following up on Michael's suggestion but the context of the issue for me was use of the "activeRBAC"; plugin/engine which does use the multiple level (e.g. plugin name = active_rbac, and under the app/controller they have a subdirectory called "active_rbac&quot; where the controllers reside.&nbsp;  Also I am housing links to these controllers in a common layout rhtml file hence the need for it to work from various spots.

--~--~---------~--~----~------------~-------~--~----~
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 rubyonrails-coregooglegroups.com
To unsubscribe from this group, send email to rubyonrails-core-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-core
-~----------~----~----~----~------~----~------~--~---

bug in routes ???
user name
2006-09-24 01:33:45
> creating subdirectories inside the controller directory
is just gonna create
> problem some time or another. I'm not surprise to see
this problem.

We make extensive use of controllers in modules and have had
very few
problems.  Tobi at shopify makes extensive use too.  We've
had no
trouble and I'm not sure what you're basing your opinion
on.

Greg's situation is complicated by the use of engines, 
perhaps ask on
their mailing list.  Can you reproduce it without engines
Greg?

-- 
Cheers

Koz

--~--~---------~--~----~------------~-------~--~----~
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 rubyonrails-coregooglegroups.com
To unsubscribe from this group, send email to
rubyonrails-core-unsubscribegooglegroups.com
For more options, visit this group at http:
//groups.google.com/group/rubyonrails-core
-~----------~----~----~----~------~----~------~--~---

bug in routes ???
user name
2006-09-24 05:37:49
Interesting...I've been going through step by step with a small test app:
  1. multiple sub-directory in standard application => works OK using absolute "/&quot; at the front of the controller value specified in a "link_to"
  2. installed engine plugin and moved the multiple sub-directory controller/view to my test engine => worked ok again with absolute value
  3. moved the links (link_to's) from the individual views to an application wide layout => seemed to work ok again
  4. introduced the :locale into the routes, and after some adjustments (i.e. putting in a default :locale of nil for each route) got this working too
In short using the (a) absolute path in the "link_to" and (b) appropriate use of a default :locale of nil, seem to have things working in a small test app.   I was getting errors previously in my full blown application when playing with some of these tweaks so I'm not sure what went wrong :(  &nbsp; I'll go back to my full blown application again and see if I can spot something.

Any comments?

Cheers
Greg

PS routes.rb file from test application
=====================================
ActionController::Routing::Routes.draw do |map|

&nbsp; map.connect ':locale/singlelevel',
 &nbsp;   &nbsp;  :controller => 'single', :action => 'testaction', 
 &nbsp;   &nbsp;  :defaults => {:locale => 'nil'}
&nbsp;
  map.connect ':locale/multilevel',
 &nbsp;   &nbsp;  :controller => 'parent/child', :action => 'testaction', 
 &nbsp;   &nbsp;  :defaults => {:locale => 'nil'}

&nbsp; map.connect ':locale',
 &nbsp;   &nbsp;  :controller => 'single',&nbsp; :action => 'index',
&nbsp;    &nbsp;  :defaults => {:locale => 'nil'}

end
=====================================

--~--~---------~--~----~------------~-------~--~----~
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 rubyonrails-coregooglegroups.com
To unsubscribe from this group, send email to rubyonrails-core-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-core
-~----------~----~----~----~------~----~------~--~---

[1-10] [11-13]

about | contact  Other archives ( Real Estate discussion Medical topics )