# Rails 1.2 doesn't send POST parameters

**URL:** <https://www.ruby-forum.com/t/rails-1-2-doesnt-send-post-parameters/92373>\
**Category:** Rails\
**Created:** [April 18, 2007, 8:13pm UTC](https://www.ruby-forum.com/t/rails-1-2-doesnt-send-post-parameters/92373 "2007-04-18T20:13:47Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Meckler](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/8c91f0/32.png) [@Michael\_Meckler](https://www.ruby-forum.com/u/Michael_Meckler)\
**Post date:** [April 18, 2007, 8:13pm UTC](https://www.ruby-forum.com/t/rails-1-2-doesnt-send-post-parameters/92373/1 "2007-04-18T20:13:47Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Michael\_Meckler](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/8c91f0/32.png) [@Michael\_Meckler](https://www.ruby-forum.com/u/Michael_Meckler)\
**Post date:** [April 18, 2007, 10:32pm UTC](https://www.ruby-forum.com/t/rails-1-2-doesnt-send-post-parameters/92373/2 "2007-04-18T22:32:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Michael\_Meckler](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/8c91f0/32.png) [@Michael\_Meckler](https://www.ruby-forum.com/u/Michael_Meckler)\
**Post date:** [April 18, 2007, 11:11pm UTC](https://www.ruby-forum.com/t/rails-1-2-doesnt-send-post-parameters/92373/3 "2007-04-18T23:11:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Michael\_Meckler](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/8c91f0/32.png) [@Michael\_Meckler](https://www.ruby-forum.com/u/Michael_Meckler)\
**Post date:** [April 19, 2007, 12:00am UTC](https://www.ruby-forum.com/t/rails-1-2-doesnt-send-post-parameters/92373/4 "2007-04-19T00:00:11Z")

</div>

My config/environment.rb has the line:

RAILS\_GEM\_VERSION = ‘1.2.3’

and I ran rake rails:update, which just seemed to change some of the  
javascript files and add a process/inspect script.

I do seem to be running the latest rails, it’s just that my  
controllers don’t seem to get passed parameters from POST calls. They  
don’t even show up in the log. But if I switch back to Rails 1.1.6  
then everything is fine.

---

<div class="post-metadata">

**Author:** ![Michael\_Meckler](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/8c91f0/32.png) [@Michael\_Meckler](https://www.ruby-forum.com/u/Michael_Meckler)\
**Post date:** [April 19, 2007, 12:16am UTC](https://www.ruby-forum.com/t/rails-1-2-doesnt-send-post-parameters/92373/5 "2007-04-19T00:16:12Z")

</div>

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[0]] = raw\_param\_split[1]  
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.

---

<div class="post-metadata">

**Author:** ![Michael\_Meckler](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/8c91f0/32.png) [@Michael\_Meckler](https://www.ruby-forum.com/u/Michael_Meckler)\
**Post date:** [April 19, 2007, 12:35am UTC](https://www.ruby-forum.com/t/rails-1-2-doesnt-send-post-parameters/92373/6 "2007-04-19T00:35:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Michael\_Meckler](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/8c91f0/32.png) [@Michael\_Meckler](https://www.ruby-forum.com/u/Michael_Meckler)\
**Post date:** [April 20, 2007, 3:05am UTC](https://www.ruby-forum.com/t/rails-1-2-doesnt-send-post-parameters/92373/7 "2007-04-20T03:05:22Z")

</div>

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.
