ryanb / nifty-generators

A collection of useful Rails generator scripts.
MIT License
1.98k stars 283 forks source link

SessionsController Index Action Error #110

Open marclipovsky opened 13 years ago

marclipovsky commented 13 years ago

In development nifty:authentication works great but when I run it in production on a live server I'm getting this error when attempting to log in:

tigers.28367 Started GET "/sessions/" for 41.135.138.170 at Wed Jun 22 06:39:35 -0700 2011 tigers.28367 06:39:35 FATAL tigers.28367 AbstractController::ActionNotFound (The action 'index' could not be found for SessionsController):

I haven't modified any of the files that nifty:authentication generates. Any ideas on why this would happen in production mode?

Also all of my gems are up-to-date and identical to the ones on my development environment.

Thanks!

marclipovsky commented 13 years ago

Ok So I even tried adding:

  def index
    render :action => :create  
  end

So and I get the same error but with the create action. It looks like it's trying to find actual template files and not reading the action itself to see what it's supposed to do.

Any help would be great. Here's the list of gems that I'm using incase you see something that's working against it.

rake (0.9.2) abstract (1.0.0) activesupport (3.0.9) builder (2.1.2) i18n (0.5.0) activemodel (3.0.9) erubis (2.6.6) rack (1.2.3) rack-mount (0.6.14) rack-test (0.5.7) tzinfo (0.3.28) actionpack (3.0.9) mime-types (1.16) polyglot (0.3.1) treetop (1.4.9) mail (2.2.19) actionmailer (3.0.9) arel (2.0.10) activerecord (3.0.9) activeresource (3.0.9) babosa (0.3.5) bcrypt-ruby (2.1.4) bundler (1.0.13) friendly_id (3.2.1.1) rdoc (3.6.1) thor (0.14.6) railties (3.0.9) jquery-rails (1.0.12) mocha (0.9.12) nifty-generators (0.4.6) paperclip (2.3.11) rails (3.0.9) sqlite3-ruby (1.2.1)

Thanks!

marclipovsky commented 13 years ago

I also just tried making my developement.rb file the same as my production.rb file and I'm getting this:

tigers.31012  07:38:06  FATAL  
tigers.31012  AbstractController::ActionNotFound (The action 'index' could not be found for SessionsController):
tigers.31012  
tigers.31012  
tigers.31012  07:38:06  INFO     Rendered /home/marclipovsky2/.gems/gems/actionpack-3.0.9/lib/action_dispatch/middleware/templates/rescues/unknown_action.erb within rescues/layout (0.8ms)

It doesn't even look like it's passing the parameters from the form or something too.

ryanb commented 13 years ago

The problem isn't in the SessionsController, so changing that won't help. The web app shouldn't be sending a GET request to the /sessions/ route at all. Is this getting triggered when you submit the login form? Check the HTML generated and make sure the <form> tag method is "post". You may need to change the form_tag method to this. Does that work?

marclipovsky commented 13 years ago

Hi Ryan,

Ok I got it working way back then but this same thing is happening again and I have method set to post so the html rendered in the new session page is this:

<form accept-charset="UTF-8" action="/sessions" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓"><input name="authenticity_token" type="hidden" value="rBUmo3QH312i/73aUMV6Qg0n1Sopiw0xv2lbfUUP3do="></div>
  <p>
    <label for="login">Email Address</label><br>
    <input id="login" name="login" type="text">
  </p>
  <p>
    <label for="password">Password</label><br>
    <input id="password" name="password" type="password">
  </p>
  <p><input name="commit" type="submit" value="Log in"></p>
</form>

Any reason why I still could be getting this?

Started GET "/sessions/" for 41.132.43.55 at Tue Sep 27 01:34:30 -0700 2011

AbstractController::ActionNotFound (The action 'index' could not be found for SessionsController):

Thanks!

marclipovsky commented 13 years ago

I actually even added an additional <input name='_method' type='hidden' value='post' /> and it still happens I do get this though when I look at my developer tools http://cl.ly/ATjw (basically saying that there was a 301 on the POST method so it sent it to GET)

marclipovsky commented 13 years ago

Turns out none of the forms on my app are passing parameters. So it most likely has nothing to do with the authentication.