Did the rules for Rails Routes changes from Rails 1.2.3 to Rails 2.2.3? I recently upgraded an application and instead of redirecting to the correct page, it now redirects to the main page (or Route page) for that matter.
The only thing that I can think of is that the routing rules changed in Rails 2.2.3.
Thanks
Yep there were a lot of changes as you can see here (look at the Action Pack Resources section) "This is where the bulk of the action for 2.0 has gone". If you're using the old semi-colon syntax then that could well be the problem. Do you want to post your route config and a quick description of what is not working?
Also, to diagnose routing problems I find running "rake routes" very useful (though set your terminal window to wide).
Chris
Related
In RubyOnRails I could say bundle exec rake routes and it was showing me all the generate routes, their verbs, the controller and action methods they hit, etc.. all in one nice report .
Is there something similar for that in ASP.NET MVC 5?
Ive used route debugger in the past and it works pretty well.
Heres a great article on it and heres a link to the nuget
Hope this helps
Are those changes major or minor? I'm concerned mostyl because gems for translating routing stopped working (rails-translate-routes - problem with helpers generating paths) and i'm looking for some way to repair it
There are some details about routing changes here Looks like the main changes are the move to the PATCH verb, raising on conflicting named routes, and direct drawing of unicode routes. The first could be significant if you're specifying the PUT verb in your routes or in custom forms in your code. The others are fairly minor for most applications I would guess.
I used this gem and it's doing fine
I recently upgraded a site from Ruby 1.8.7 to Ruby 1.9.2, and from Rails 3.0.x to 3.2.x. I noticed that some of my legacy urls weren't being handled correctly anymore, and wanted to diagnose the issue.
Here's what I noticed.
http://myapp.com/links/oldlink.html had, in my old app, provided a params[:path] of /links/oldlink.html, but now is providing links/oldlink. So it's dropping the leading forwardslash as well as the file extension.
Can anyone help me figure out what's going on here? Of course I can manually change the legacy strings in my database to also drop their forward slashes and file extensions, but that seems like a hacky solution, and I want to make sure I understand the underlying principles that account for this change in the Rails routing behavior.
Thanks!
You should try this in your routes.rb
match '/foo', :to => redirect('/foo.html')
I'm running Rails 2.3.4. When I create a new rails project, the public/index.html file has a link named "About your application's environment" that points to "rails/info/properties". In dev mode, it gives a summary of the runtime environment. However, in production mode, it gives a 404 page cannot be found.
Could someone point me in the direction of how and where the "rails/info/properties" route is configured? I'd just like to understand how it's set up.
The link fires off an AJAX request to rails/info/properties. The properties action is defined in the Rails::InfoController which lives in /rails/railties/builtin/rails_info/rails/info_controller.rb.
The route doesn't need to be explicitly defined because it conforms to the Rails default route of :controller/:action/:id (although there is no ID in this case and the controller lives within a Rails namespace.)
It's configured within Rails itself (when in development mode). You can probably track it down if you look through the Rails initialization code.
I have an extremely simple routes.rb in my Rails app:
ActionController::Routing::Routes.draw do |map|
map.resources :tags
end
Starting up my app with script/server and pointing my browser to localhost:3000/tags/ yields:
ActionController::MethodNotAllowed
Only get and post requests are allowed.
...
Starting up my app with script/server webrick, however, solves the problem.
Later: in case it matters, I'm running Mongrel 1.1.5 on OSX 10.5.5.
Check your generated routes for problems with "rake routes | grep tag"
Check the actual method that is being called, and the verb it is being called with by tail -f log/development.log
This should bring up any obvious problems.
I have seen this happen with older versions of mongrel, but 1.1.5 is not old. I have also seen some similar problems when the browser double-posts a request to a URL. Is that happening here?
I'd need some more information to be able to help you: What browser are you using? Are you using the firebug plugin on Firefox? What does the server log say about the request, other than the MethodNotAllowed exception?
Somethings to check:
sometimes you need to restart your server to load new routes.
TagsController exists?
index action in TagsController exists?
I'm curious to see the stack trace here.
Did you check your codes for example related with form_for, to check if has any typo? When you run rake routes, everything is fine? I saw this problem before and it was related with a typo in the form_for parameters.
Did you update your mongrel? gem update mongrel?
Did you check your project log? log*.log?
Regards,
Victor