Forum: Ruby on Rails Rails 1.2 doesn't send POST parameters

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
2024cf02311a8c27577c61679805d641?d=identicon&s=25 Michael Meckler (Guest)
on 2007-04-18 20:13
(Received via mailing list)
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?
7223c62b7310e164eb79c740188abbda?d=identicon&s=25 Xavier Noria (Guest)
on 2007-04-18 22:32
(Received via mailing list)
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
40db9e75b3f5899258e3bdc0c9210154?d=identicon&s=25 Conrad Taylor (Guest)
on 2007-04-18 23:11
(Received via mailing list)
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
2024cf02311a8c27577c61679805d641?d=identicon&s=25 Michael Meckler (Guest)
on 2007-04-19 00:00
(Received via mailing list)
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.
2024cf02311a8c27577c61679805d641?d=identicon&s=25 Michael Meckler (Guest)
on 2007-04-19 00:16
(Received via mailing list)
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.
40db9e75b3f5899258e3bdc0c9210154?d=identicon&s=25 Conrad Taylor (Guest)
on 2007-04-19 00:35
(Received via mailing list)
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
2024cf02311a8c27577c61679805d641?d=identicon&s=25 Michael Meckler (Guest)
on 2007-04-20 03:05
(Received via mailing list)
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.
This topic is locked and can not be replied to.