This project is archived and is in readonly mode.
URL Generation for routes that point to a Rack application include the controller and action parameters
-
Rizwan Reza
- State changed from new to open
- Tag changed from rails3 routes to rails3, routes
- Milestone cleared.
Can you provide a failing test case?
-
Rizwan Reza
I cannot reproduce this. It is correctly generating URLs for a rack app at my side. You can write a failing test case in
routing_test.rb. -
Gaël Deest
Hi, this might be related. Here is my controller:
class MyControllerController < ApplicationController before_filter { |controller| render :text => controller.url_for(controller.params) } def my_action; end endOutput:
http://localhost:3000/my_controller/my_action?action=my_action&controller=my_controller -
Dan Pickett
- Tag changed from rails3, routes to bugmash, rails3, routes
-
Dan Pickett
- No changes were found…
-
Bobby Wilson
I also could not reproduce this.
Brad,
Can you simplify your problem code any? -
Indrek Juhkam
The problem is
:to => SocketControllerpart. Rails doesn't translate it. If you change it to:to => "socket#index"then it works.How to reproduce:
Create Test1Controller and Test2Controller.
To routes.rb add
match "test1", :to => "test1#index" match "test2", :to => Test2Controller, :as => :test2Now add an index action to the Test1Controller
def index render :text => test2_url endGo to /test1 url and see the response.
-
Rohit Arondekar
Confirmed on Rails master (on Ruby 1.9.2-head) by following instructions given by Indrek. Also note that test2_path has the same problem. Also the rake routes output:
test1 /test1 {:controller=>"test1", :action=>"index"}
test2 /test2And just glancing through http://edgeapi.rubyonrails.org/classes/ActionDispatch/Routing.html I don't Rails is expected to handle Test2Controller in :to.
-
Neeraj Singh
Attached is a patch with test.
-
José Valim
- State changed from open to wontfix
-1 for supporting the controller class in the router API (and you don't want that, because it will force ActionController to load if you are using simple stuff like rake tasks).
-
Andrew White
- State changed from wontfix to invalid
Actually it's invalid - you just need to specify the end point.
resources :channels do resources :people resources :events do collection do get :socket, :to => UsersController.action(:show) end end endThe original subject of the ticket is invalid as well:
andyw$ rails c >> app.socket_channel_events_url('1', :protocol => 'ws') => "ws://www.example.com/channels/1/events/socket" -
Andrew White
- State changed from invalid to open
- Milestone cleared.
- Importance changed from to High
Sorry, this isn't invalid. The problem occurs when you have recall params which get added to the url as there isn't a controller and action when routing to a block, proc or class. Attached patch removes controller and action when the target route isn't a Dispatcher instance.
-
Repository
- State changed from open to resolved
(from [91b52c795f62aa15505f2f098bc86d6f6db75105]) Normalize recall params when the route is not a standard route otherwise :controller and :action may appear in the generated url [#4326 state:resolved]
Signed-off-by: José Valim jose.valim@gmail.com
http://github.com/rails/rails/commit/91b52c795f62aa15505f2f098bc86d...
