Only get, put, and delete requests are allowed


I'm running into an odd problem here. Everything was working fine until I started playing with my application this morning. It seems that when I try to use my login action, I'm instead given this error.

Only get, put, and delete requests are allowed

This happens only after I submit the form. The login page is displayed fine when it's displayed using the GET method. Here is my controller code:

  def login     session[:member_id] = nil     if       member = Member.authenticate(params[:username], params[:password])       if member         session[:member_id] =         flash[:notice] = "You have successfully logged in!"         redirect_to stories_path       else[:notice] = "Invalid username/password combination"       end     end   end

None of the code runs from within the 'if' block. I removed the code and simply added a redirect_to to see what would happen, and the error still persists. At the bottom of the error page, it says:

{"cookie"=>, "Cache-Control"=>"no-cache", "Allow"=>"GET, PUT, DELETE"}

Is there a way to edit this to allow POST as well?

I've read on the Internet that moving your route high in the file will help, it didn't. My rout looks like:

map.resources :members, :collection => { :login => :get, :logout => :get }

From day one, I've had this error message pop up often. It seemed to do so after editing my routes. A simple reboot of my server resolved the problem on these occasions - it's not helping here.

Any help would be appreciated. I've already played with this for a few hours with no luck. :frowning: Thanks for your time!

~Dustin Tigner

try :login => :any You've said that login had to be a get, but your're doing a post.


try :login => :any

That did the trick. I wonder why it has been working all this time with :get instead of :any. That's very peculiar!


Thank you very much for your help!

~Dustin Tigner