1

I have a typical signup form which has, for example, three fields: login, password, and email. We're using rails' form helpers, so we are expecting these to come to us in a hash named user.

Something close to what we'd expect:

Parameters: {"action"=>"new", "controller"=>"users", "user"=>{"password"=>"[FILTERED]", "login"=>"new_user_login", "email"=>"new_user_email"}}

We then do stuff like: params[:user].merge(SOME_HASH) # some other stuff we want to save into the user object

A few times a day we're getting "undefined method `merge' for String", and looking at those requests, the params are instead coming in as:

Parameters: {"action"=>"new", "controller"=>"users", "user"=>"login=new_user_login&email=new_user_email&password=[FILTERED]"}

params[:user], which we expect to be a hash, is coming in as a single query string, leading to the error.

Has anyone else seen this in their logs? It's coming from the same form as the others, and it's a valid POST with authenticity_token set, etc. And looking for that login in our DB, we found that the user retried the request and succeeded.

Could it also be at the fault of the browser? This individual was Firefox 3.6 on a Mac.

Gee Chuang
  • 11
  • 2
  • What versions of Ruby and Rails are you using? Also, do you have any Rack middleware? It's not likely, but something could be intercepting it before it gets to your controller method. Also, it could be a text encoding issue. Were there any unusual characters in any of these entries? Ruby 1.8 has some encoding oddities. – michaeltomer Apr 29 '11 at 18:52
  • We're running Rails 2.3.2 and Ruby 1.8.7 (Enterprise). We're not running rack middleware, and in this case all of the characters coming in were plain ascii characters. Thanks for the help! – Gee Chuang Apr 29 '11 at 19:01

0 Answers0