views:

52

answers:

2

When I log in on my dev machine in an ROR application, I should be redirected to http://sitename/user/dashboard. This was happening successfully before, till I began developing on it :). Now it tries to go to http://sitename/user/images/navarrow, which results in the error ActionController::UnknownAction (No action responded to images).

I hadnt changed anything in the code except layout,views-level changes, no actions etc were changed. Then I reverted to a previous version to check, and it worked fine. I reverted back to my latest version and it again worked fine. So the problem doesnt seem to be in code, but somewhere else. I want to know why exactly this problem crops up every now and then. The fix is not hard, i just have to revert to a previous commit and then come back to latest commit, but I cannot figure out how it tries to redirect to a wrong url in the first place. Do I need to change some configuration to make it not happen again?

UPDATE: I had to work on the UI of the login form as well. Now when I created a login form with the required css, and tried to submit, this is what i get: Parameters: {"format"=>"jpg", "action"=>"images", "id"=>"galway", "controller"=>"user"} ActionController::UnknownAction (No action responded to images):

As you can see, I get another different faulty url, the prvious one had :id=>'navarrow'. SO I get the same error as above of a faulty url creeping out of nowhere! But wehn i go back and refresh, i discover that i actually am logged in, so the new login form is working as expected. i think if i commit my code now, and then go thru th process again, it will work again, but this bug is driving me crazy!

A: 

I'd check that you don't have something sneaking in .htaccess files to your directories (maybe one got accidentally checked in)?

Mike Buckbee
I have seen that I havent changed anything in the public/.htaccess file, so it doesnt look like it is a .htaccess issue. there is only one htaccess file in the application, and it is checked in.
+1  A: 

I think i figured it out partially. In the page, there were two images, entered like so:

<img src="images/nav_arrow.jpg".../>
<img src="images/galway.jpg".../>

So for some reason when a form got posted, and we were redirected to another page, somehow it also tried to map its request to controller/images/nav_arrow.jpg etc, and this was causing the unexpected behavior. But I still have to figure out why this error does not always crop up. I change image paths to absolute ones to make it work!