views:

173

answers:

3

I'm using the RESTful authentication Rails plugin for an app I'm developing. I'm having a strange issue I can't get to the bottom of. Essentially, the first time I log into the app after a period of inactivity (the app is deployed in production, but only being used by me), I will be brought to a 404 page, but if I go back to the home page and log in again, everything works according to plan. Any ideas?

+2  A: 

Please check your routes.

Not all routes are created equally. Routes have priority defined by the order of appearance of the routes in the config/routes.rb file. The priority goes from top to bottom. The last route in that file is at the lowest priority and will be applied last. If no route matches, 404 is returned.

More info: http://api.rubyonrails.org/classes/ActionController/Routing.html

Espo
+1  A: 

I'm using a slightly modified version of that plugin so I'm not 100% sure that this will be the same for you, but for me the default is to redirect to the root path, or the page you were trying to get to if there is one. (check your lib/authenticated_system.rb to see your default) If you don't have map.root defined in your routes, I believe that would cause the error you're describing -- it wouldn't find root_path at first but if you tried "from" a page in your app it would redirect to that page.

Let us know what happens with this one if you would, I'm curious to see what this ends up being in case I run into it in the future. :)

PJ
A: 

I never knew routes had priority. Thanks so much for the help.

Bryan Woods