I have a strange problem with my Rails app that I haven't seen anyone else mention. I upgraded to rails 1.2 today (1.2.3 actually, and yes, I've been putting it off). When I did so all of my controllers that accept a POST method lost their paraameters. The param hash is empty when those controllers get called, and they can't access any of the form parameters. Controllers that are called via GET still work fine. I reverted back to 1.1.6 and everything is fine. What could be causing this?
on 2007-04-18 20:13
on 2007-04-18 22:32
On Apr 18, 2007, at 8:12 PM, Michael Meckler wrote: > I upgraded to rails 1.2 today (1.2.3 actually, and yes, I've been > putting it off). When I did so all of my controllers that accept a > POST method lost their paraameters. The param hash is empty when those > controllers get called, and they can't access any of the form > parameters. Controllers that are called via GET still work fine. I don't really know whether the lack of this step can have that consequence, but just in case, did you run rails:update in the root of your application after the upgrade of Rails itself? -- fxn
on 2007-04-18 23:11
Hi, there are two actions that should take place after performing 'gem update rails': a) update environment.rb so that it uses 1.2.3 b) execute 'rake rails:update' in the root directory of your rails application -Conrad
on 2007-04-19 00:00
on 2007-04-19 00:16
I found someone else who has this same problem. His solution was to add this method in the application controller: def parse_post_params request.raw_post().split('&').each do |raw_param| raw_param_split = raw_param.split('=') params[raw_param_split] = raw_param_split end end and then call parse_post_params in every method of every controller. This does seem to work for me, at least, in the methods I added it to. But it seems a horrible violation of DRY. So I'm looking for a better solution.
on 2007-04-19 00:35
Hi, how are you getting to the controller/action (i.e. what are you doing to invoke the action... ) ? Please post your controller code and/or relevant views. -Conrad
on 2007-04-20 03:05
I think I found the problem. The forms were being submitted not from a browser, but from an external server which was just sending HTTP at my Rails app. There wasn't any view involved at all. The HTTP_MIMETYPE header wasn't set to anything. This didn't seem to bother Rails 1.1.6, but with Rails 1.2.x it seems to ignore the POST block if this is not set to "application/x-www-form-urlencoded" When I made sure that header was set properly in the sending server, then my Rails app got all the params passed through properly.