New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rake routes for a redirect is unhelpful #6369
Comments
This isn't as straightforward as it sounds because the string is wrapped in a |
@pixeltrix - This might be a start...but you are right...it's not straightforward. |
Hey guys, please check #6391 for a working implementation that possible fix this. |
@drogus ops, guess you were faster, thanks! :D |
@carlosantoniodasilva I think we can do a bit more than just reporting the status - we should also output the path or options if available |
Yes, you're right, and I'd like to see more verbose output as well, but like you said in your first comment it's not as straightforward as it sounds because of request object passed as block argument. Consider this example: match 'jokes/:number', :to => redirect { |params, request|
path = (params[:number].to_i.even? ? "wheres-the-beef" : "i-love-lamp")
"http://#{request.host_with_port}/#{path}"
} Right now it's hard to generate this one and render on inspection as you need Rack::Request object. I agree that it would be better to show something more, but right now, there's no simple solution for that. Do you have idea how to solve this? |
I think we can so something better for simple redirects like this: get '/foo/:id' => redirect('/bar/%{id}'), :as => :foo
get '/bar/:id' => redirect(:subdomain => 'shop', :path => '/bar/%{id}'), :as => :bar I think you could output these as something like:
whereas generic redirects would be something like:
I'm in two minds whether these need wrapping with |
Sorry, I've missed the discussion here before I've merged it. Thanks for work on this @pixeltrix! :) |
That was quick! I was about to start improving it ;-) Thanks @pixeltrix. |
@pixeltrix the output is looking great, thanks :) |
Given a route in routes.rb:
When I run
rake routes
Then I expect to see:
But I currently see:
The text was updated successfully, but these errors were encountered: