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
route params changing after saving file #631
Comments
Thanks for the report, we are working on fixing this soon and pushing a patch release. |
You can always disable reload in the interim if its blocking development |
I've added a test for this: 4d7069e |
Thanks, does the test pass for both of these? Why is this issue coming up? Is it the development reloader @DAddYE. Perhaps we should make the change soon to fork_reloader by default for non windows? (and extract current reloader to a gem) |
I think we reload a class that don't need that. Those that have this problem can gist me: puts Padrino::Reloader.exclude_constants
puts Padrino::Reloader.include_constants Add these lines in your controller and copy the result only when reloading was wrong. Thanks so much! |
https://gist.github.com/1148389 Here's mine.. happens after saving, same pattern.. becomes nested array in hash rather than straight hash. |
Interesting, out of curiosity I wonder if this was introduced into 0.10.1 or if has been around since 0.10? |
From what I can tell it snuck in with 10.1... maybe the difference is in http_router versions? |
For what it's worth, editing helpers also causes this to happen. |
Yeah the reloader didn't change much in this version. I wonder what caused this to appear... @DAddYE @joshbuddy |
Could it be:
Edit: No, I just rolled back the gem version used by core to try it.. still get the same error. |
Interesting, so you don't get this in padrino 0.10.0. But you do get this in 0.10.1 using http_router 0.8.10? Is that right? |
That's right. |
Ok thanks for experimenting and reporting back. So it isn't changes to http_router. It must be something between 0.10.0 and 0.10.1... |
0.10.0...0.10.1 is a comprehensive diff. Was trying to spot changes to the reloader...so far no luck (perhaps 0.10.0...0.10.1#diff-21) |
How about in the routing.rb in core/application? |
Yeah that's by far the most likely culprit although not clear to me what about it would introduce this behavior... |
I'm going to step back through versions to see where the bug came in.. |
Awesome man, I really appreciate you helping us investigate this |
Oops.. made a mistake sorry, when called with a "Sinatra style" route, it didn't work.. back to square one.. :( |
It's changing before it enters the process_destination_path(path, env) method.. this sets @params to env['router.params'], but outputting env['router.params'] right at the start of this method still shows the change from object to object with nested array.. Edit: Spent a good amount of time trying to find what was triggering the change to no avail.. sorry. Whatever is responsible for generating request.params seems to be the place to look.. |
Will fork and send pull request soon. Issue was caused by matchers being added to http_routing in a different order at reload time than at load time. this turns request.params into an array with an array inside of it. Fix is to make reload! load the user-defined routes before the default routes so that the lookup_node code is reached before the glob code. Change
to def reload! |
Can you guys confirm me that this problem gone away? If not reopen! Thanks |
Obviously thanks so so much to @chromaticbum, awesome work! |
Great work @chromaticbum. Thanks a bunch! |
I have this:
get "/page/:page" do
params.inspect
end
I start up padrino via "padrino start", then hit this in my browser:
http://localhost:3000/page/2
I get this:
{:page=>"2"}
If I go back to the file, and change it to this:
get "/page/:page" do
params.inspect
end
(notice, I'm only adding a space before the params.inspect) - then hit the browser again at http://localhost:3000/page/2, I get this:
{:page=>["page", "2"]}
This seems like a code reloading issue?
The text was updated successfully, but these errors were encountered: