search for: recognize_path

Displaying 20 results from an estimated 55 matches for "recognize_path".

2007 Feb 10
3
recognize_path discrepency
hey all - wondering if someone would relive my confusion... given a model called say Meeting and a route as "map.resources :meetings" in the console: >>r=ActionController::Routing::Routes >>r.recognize_paths "/meetings" =>{:action="index",:controller=>"meetings"} all works as I expect, but if I do >>r.recognize_paths "/meetings/1" =>{:action="1",:controller=>"meetings"} which is what Id expect for a map.connect, but not fo...
2011 Jun 21
0
Status of Rails.application.routes.recognize_path()
...the "Ruby on Rails: Core" group, but I''ll try it out here first... So, while writing a gem (engine) for rails, I found that I needed to have my app (in a pre-filter) directly query the router. In the "old" days, this was done using ActionController::Routing::Routes.recognize_path(). My 2nd edition of "Agile Web Development with Rails" (which covers rails 1.2) even demonstrates how to use it in a rails console to verify your routes. This is now deprecated (in rails 3.0.x) as indicated by the following warning in my application log: DEPRECATION WARNING: ActionC...
2009 Mar 06
2
Routes.recognize_path on more complicated Routes
...i''m writing i''m extending the standard link_to helpers to check if a user has a permission to perform that action before displaying a link to clean-up my code so i don''t have to put if checks all over them. I''m trying to use.. ActionController::Routing::Routes.recognize_path(url, :method => method) to get the action and controller out so i can check those permissions. The problem im having is when it comes to more complicated routes the recognize_path method gets things mixed up e.g. /admin/users/60/edit - Controller: admin/users | Action: 60 | Id: edit - Correc...
2011 Jun 22
3
Status of Rails.application.routes.recognize_path()
...kind-of (also, I first tried asking in "Ruby on Rails: Talk" to no avail.). So, while writing a gem (engine) for rails, I found that I needed to have my app (in a pre-filter) directly query the router. In the "old" days, this was done using ActionController::Routing::Routes.recognize_path(). My 2nd edition of "Agile Web Development with Rails" (which covers rails 1.2) even demonstrates how to use it in a rails console to verify your routes. This is now deprecated (in rails 3.0.x) as indicated by the following warning in my application log: DEPRECATION WARNING: ActionC...
2006 Oct 03
0
rs.recognize_path "/home" is not working in script/console
My application runs fine. I just want to change a few routing rules and I decided to test using script/console. But I''m getting following error. Loading development environment. >> rs = ActionController::Routing::Routes >> rs.recognize_path "/home/index" TypeError: can''t convert Fixnum into String from c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/routing.rb:228:in `travers e_to_controller'' from generated/routing/recognition.rb:7:in `recognize_path''...
2007 Nov 16
3
Route Information
Is there a method to return a hash of the route configuration based on a path? For example: magic_method(''/my_controller/my_action/my_id'') => {:controller => ''my_controller'', :action => ''my_action'', :id => ''my_id''} Thanks! Tom --~--~---------~--~----~------------~-------~--~----~ You received this message
2007 Sep 16
2
Problem with recognize_path
Hello, I am experiencing a weird problem on one of the 3 test servers I''m using: There is a controller named admin/statistics and I am trying to access /admin/statistics The matching rule is: map.connect '':controller/:action/:id'' On 2 of the 3 servers, recognize_path correctly matches to Parameters: {"action"=>"index", "controller"=>"admin/statistics"} But on the 3rd server here is what happens: Parameters: {"action"=>"statistics", "controller"=>"admin"} Of course that a...
2009 May 01
4
Can't get to an action in a RESTful controller
...t;show"} GET /users/:id.:format/ {:controller=>"users", :action=>"show"} That may explain why /users/resetpwd is mapping to the show action in UsersController because "resetpwd" is being taken as the :id for the GET action on /users. But when I run a recognize_path command as below in script/console it seems to resolve correctly >> rs.recognize_path "/users/resetpwd" => {:controller=>"users", :action=>"resetpwd"} I have two questions. 1. Why does recognize_path resolve to action "resetpwd" while when t...
2007 Oct 03
3
manually invoking routing?
Hey folks. I have a rails controller which is filtering search results for access control. The search results are typically URLs into the rest of the rails app. I''m finding it would simplify the grotty code which is accumulating if I could manually invoke the router. That is to say, if I could send something a URI path string and get back the hash of controller, action, and params that
2007 Aug 25
4
REST routes :has_many , new style
I am trying to write a nested route ''new style'' map.resources :franchises, :has_many => :documents in place of the : map.resources :franchises do |franchises| franchises.resources :documents, :name_prefix => "franchise_" end but get an error : no route found to match "/franchises/1/documents" with {:method=>:get} running rake routes,
2006 Jul 20
5
Why don''t I get 404s?
When I go to a missing page in my rails app, I get the 500.html page, and this in my log output: no route found to match "/asdasd" with {:method=>:get} ./script/../config/../vendor/rails/actionpack/lib/action_controller/ routing.rb:1057:in `recognize_path'' ./script/../config/../vendor/rails/actionpack/lib/action_controller/ routing.rb:1047:in `recognize'' ./script/../config/../vendor/rails/railties/lib/dispatcher.rb:38:in `dispatch'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13/lib/mongrel/rails.rb: 85:in `process...
2006 Feb 22
7
Ruby on Rails with Apache2, MS SQL on Windows XP
...ork Trace | Full Trace C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:195:in `const_missing'' C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:72:in `const_missing'' generated/routing/recognition.rb:4:in `recognize_path'' C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:195:in `const_missing'' C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:72:in `const_missing'' C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/li...
2006 Jul 05
1
Routing error "unitialized constant" after refactoring
...issing'' /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:131:in `const_missing'' /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:133:in `const_missing'' generated/routing/recognition.rb:4:in `recognize_path'' /opt/local/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/routing.rb:510:in `recognize!'' /opt/local/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/dispatcher.rb:38:in `dispatch'' /opt/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3/lib/mongrel/rails.rb:73:in `pro...
2006 Apr 03
3
[newbi] Problem Routes
...2.5/lib/active_support/dependencies.rb:200:in `const_missing'' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/Resources/ports/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:72:in `const_missing'' generated/routing/recognition.rb:4:in `recognize_path'' This error occured while loading the following files: note_controller.rb Where is the problem ? Bolo
2006 Apr 21
0
Troubleshooting recognition failures?
How does one go about troubleshooting a "Routing Error" "Recognition failure"? I''ve used the Webrick log to get down to a "recognize_path(path)" call in /actionpack-1.12.1/lib/action_controller/routing.rb and put a logger.debug path there, but that just told me what I already knew, and the definition of "recognize_path" looks like its dynamically generated code. PS: Interestingly, I only get a traceback to routing...
2006 Aug 14
0
Recognition failed for ...
...' /usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/fcgi_handler.rb:23:in `process!'' /mnt/b/www/rails/test1/public/dispatch.fcgi:24 I''ve slightly changed recognition_failed in routing.rb:522 to also display the request.path as well as the path parameter that''s passed to recognize_path. def recognition_failed(request, path) raise ActionController::RoutingError, "Recognition failed for #{request.path.inspect} req.path=#{request.path} path=#{path}" end Where is the recognize_path function and what can I do to be able to see why is it not recognizing the controlle...
2009 Nov 10
10
Un-recognised routes that do exist, using namespaces & subdomain checking
...ng with the following I never get the dumps when using RSpec even though both these are called pretty early on in route recognition. module Foo module RouteSetExtensions def self.included(base) base.alias_method_chain :extract_request_environment, :debug base.alias_method_chain :recognize_path, :debug end def recognize_path_with_debug(path, environment={}) puts path puts environment.to_yaml recognize_path_without_debug(path, environment) end def extract_request_environment_with_debug(request) env = extract_request_environment_without_debug(reques...
2008 Feb 01
1
Rails routing and active scaffold fight to the death
...INFO Parameters: {} [2008-02-01 14:54:00] (552) FATAL ActionController::RoutingError (no route found to match "/javascripts/ active_scaffold/default/" with {:method=>:get}): C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/routing.rb:1292:in `recognize_path'' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/routing.rb:1282:in `recognize'' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/ dispatcher.rb:40:in `dispatch'' C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel...
2006 Aug 05
1
"uninitialized constant" error when I go to app base URL???
...tactController): /usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:100:in `const_missing'' /usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:131:in `const_missing'' generated/routing/recognition.rb:4:in `recognize_path'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/routing.rb:477:in `recognize!'' /usr/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/dispatcher.rb:38:in `dispatch'' /usr/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/fcgi_handler.rb:150:in `process_reques...
2009 Aug 13
6
Strange Routing
...':controller/:action/:id.:format'' Using console I did >> rts = ActionController::Routing::Routes >> rts.generate(:action => "edit", :controller => ''vendorlocations'', :id => 10) => "/vendorlocations/10/edit" >> rts.recognize_path("/vendorlocations/10/edit") => {:action=>"10", :id=>"edit", :controller=>"vendorlocations"} 1) I don''t understand why the ID is where the action is when I generate the router 2) And because of that the :id and :action have been switched....