# Controllers not passed as a parameter causing an error

**URL:** <https://www.ruby-forum.com/t/controllers-not-passed-as-a-parameter-causing-an-error/184423>\
**Category:** Rails\
**Created:** [March 2, 2010, 11:58am UTC](https://www.ruby-forum.com/t/controllers-not-passed-as-a-parameter-causing-an-error/184423 "2010-03-02T11:58:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ajibanda](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a8b319/32.png) [@ajibanda](https://www.ruby-forum.com/u/ajibanda)\
**Post date:** [March 2, 2010, 11:58am UTC](https://www.ruby-forum.com/t/controllers-not-passed-as-a-parameter-causing-an-error/184423/1 "2010-03-02T11:58:37Z")

</div>

Hi!

I have an app that is already working on a shared host, but I need to  
run this on another server that was setup from scratch. Currently, the  
server has the following specs:

OS: ubuntu  
Apache 2  
MySQL 5  
Rails 2.3 (but I’m using 2.0/2.1)  
Ruby 1.8.6  
FastCGI(mod\_fcgid)

So far the application works fine but during the submitting of forms I  
sometimes get an error and on the log file was

Processing ApplicationController#index (for 122.55.107.51 at  
2010-03-01 18:18:36) [PUT]  
Session ID:  
BAh7EjoRY291bnRkb3duMTU1aQA6DmxvZ2ludGltZXU6CVRpbWUNKogbgN6i  
Q0k6CHdob2kHOg5hY2NvdW50aWRpAZs6CW1pbmVGOhB0aGlzYWNjb3VudG86  
DEFjY291bnQTOgpAY2hhdDA6HEBuZXdfcmVjb3JkX2JlZm9yZV9zYXZlMDoP  
QGd1aWRhbmNlczA6CkBkaWZmZhAwLjMwNzMxMQDeGjoPQG1lZF9maWxlczA6  
FkBzdHVkZW50X3BheW1lbnRzMDoQQGF0dHJpYnV0ZXN7FSIJbmFtZSIQQWFy  
b24gSmFtZXMiD2NyZWF0ZWRfYXQiGDIwMTAtMDMtMDEgMDk6NDU6MzkiEGRl  
c2lnbmF0aW9uIglUZXN0Ig91cGRhdGVkX2F0dTsHDSqIG4DFCA9KIg11c2Vy  
bmFtZSINYWppYmFuZGEiCWx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ob25lIi0oNjMpICgwNDUpIDMyMi02OTY2LCAoNjMp  
ICgwNDUpIDYyNS04MTg4IhBzY2hvb2xfdHlwZSIMREVGQVVMVCIKZW1haWwi  
GG5vcmVwbHlAZGVmYXVsdC5jb207FXsAIgpmbGFzaElDOidBY3Rpb25Db250  
cm9sbGVyOjpGbGFzaDo6Rmxhc2hIYXNoewY6C2FjY2VzczAGOgpAdXNlZHsG  
OyVUOgp3aG9pc0AT–b79de4b228fd131633b0e57a1b637a76f2b1daac  
Parameters: {“commit”=\>“Apply Changes”,  
“authenticity\_token”=\>“caee96526e0e6c3739958d67171d74066065605c”,  
“\_method”=\>“put”, “color”=\>{“navbarbg”=\>"#069", “navbarin”=\>"#9cf",  
“fcolor”=\>"#333", “bgcolor”=\>"#369"}}

NameError (uninitialized constant  
ActionController::CgiRequest::Encoding):  
/vendor/rails/activerecord/lib/…/…/activesupport/lib/  
active\_support/dependencies.rb:492:in `const_missing' /vendor/rails/actionpack/lib/action_controller/cgi_process.rb: 68:in`body’  
/vendor/rails/actionpack/lib/action\_controller/request.rb:297:in  
`raw_post' /vendor/rails/actionpack/lib/action_controller/request.rb:391:in`parse\_formatted\_request\_parameters’  
/vendor/rails/actionpack/lib/action\_controller/cgi\_process.rb:  
80:in `request_parameters' /vendor/rails/actionpack/lib/action_controller/request.rb:304:in`parameters’  
/vendor/rails/actionpack/lib/action\_controller/request.rb:22:in  
`request_method' /vendor/rails/actionpack/lib/action_controller/request.rb:35:in`method’  
/vendor/rails/actionpack/lib/action\_controller/routing/  
route\_set.rb:431:in `extract_request_environment' /vendor/rails/actionpack/lib/action_controller/routing/ route_set.rb:384:in`recognize’  
/vendor/rails/actionpack/lib/action\_controller/dispatcher.rb:  
148:in `handle_request' /vendor/rails/actionpack/lib/action_controller/dispatcher.rb: 107:in`dispatch’  
/vendor/rails/actionpack/lib/action\_controller/dispatcher.rb:  
104:in `synchronize' /vendor/rails/actionpack/lib/action_controller/dispatcher.rb: 104:in`dispatch’  
/vendor/rails/actionpack/lib/action\_controller/dispatcher.rb:  
120:in `dispatch_cgi' /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:35:in`dispatch’  
/vendor/rails/railties/lib/fcgi\_handler.rb:103:in  
`process_request' /vendor/rails/railties/lib/fcgi_handler.rb:153:in`with\_signal\_handler’  
/vendor/rails/railties/lib/fcgi\_handler.rb:101:in  
`process_request' /vendor/rails/railties/lib/fcgi_handler.rb:78:in`process\_each\_request’  
/usr/lib/ruby/gems/1.8/gems/fcgi-0.8.8/lib/fcgi.rb:612:in  
`each_cgi' /usr/lib/ruby/gems/1.8/gems/fcgi-0.8.8/lib/fcgi.rb:609:in`each’  
/usr/lib/ruby/gems/1.8/gems/fcgi-0.8.8/lib/fcgi.rb:609:in  
`each_cgi' /vendor/rails/railties/lib/fcgi_handler.rb:77:in`process\_each\_request’  
/vendor/rails/railties/lib/fcgi\_handler.rb:76:in `catch' /vendor/rails/railties/lib/fcgi_handler.rb:76:in`process\_each\_request’  
/vendor/rails/railties/lib/fcgi\_handler.rb:50:in `process!' /vendor/rails/railties/lib/fcgi_handler.rb:24:in`process!’  
/public/dispatch.fcgi:26

The weird part here is I don’t know, when and how it usually happens  
since most of the time it would work fine but sometimes it appears.  
before I thought it has something to do with my session expiration  
feature, but as I was checking it seems that this usually happens  
during the submitting of forms. Does anyone know the cause of this?

Actually this error causes problems on session after it happens… I  
prove it since I cannot login after this happens. Also I usually use  
this command to fix this temporarily…

[sudo] killall -TERM dispatch.fcgi

EDIT: after some more testings, I found out that sometimes the  
controller and action parameters are not being passed and the  
controller that is being executed is the Application Controller. Does  
any one knows how this happens?

---

<div class="post-metadata">

**Author:** ![ajibanda](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a8b319/32.png) [@ajibanda](https://www.ruby-forum.com/u/ajibanda)\
**Post date:** [March 2, 2010, 12:03pm UTC](https://www.ruby-forum.com/t/controllers-not-passed-as-a-parameter-causing-an-error/184423/2 "2010-03-02T12:03:53Z")

</div>

See on the database is there is any row with out id  
if not then pass id to controller by this  
:id = object.id

On Tue, Mar 2, 2010 at 9:58 AM, ajibanda [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Ruby 1.8.6  
> DEFjY291bnQTOgpAY2hhdDA6HEBuZXdfcmVjb3JkX2JlZm9yZV9zYXZlMDoP  
> IEFjdGl2ZVN1cHBvcnQ6OlRpbWVXaXRoWm9uZVsIdTsHDSqIG4AAACBEIgtU  
> b24iACIHaWQiBjEiCnBob25lIi0oNjMpICgwNDUpIDMyMi02OTY2LCAoNjMp  
> NameError (uninitialized constant  
> 80:in `request_parameters' /vendor/rails/actionpack/lib/action_controller/dispatcher.rb: `dispatch’  
> /usr/lib/ruby/gems/1.8/gems/fcgi-0.8.8/lib/fcgi.rb:609:in `each’
> 
> [sudo] killall -TERM dispatch.fcgi  
> To post to this group, send email to removed\_email\_address@domain.invalid.  
> To unsubscribe from this group, send email to  
> removed\_email\_address@domain.invalid[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> .  
> For more options, visit this group at  
> [http://groups.google.com/group/rubyonrails-talk?hl=en](http://groups.google.com/group/rubyonrails-talk?hl=en).

–  
Thanks:  
Rajeev sharma

---

<div class="post-metadata">

**Author:** ![ajibanda](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a8b319/32.png) [@ajibanda](https://www.ruby-forum.com/u/ajibanda)\
**Post date:** [March 3, 2010, 7:47am UTC](https://www.ruby-forum.com/t/controllers-not-passed-as-a-parameter-causing-an-error/184423/3 "2010-03-03T07:47:34Z")

</div>

Thanks kannav for replying

I’m pretty sure that every row has an ID. I’ve been trying to look for  
more details on this error and I found out more updates on this one. One  
of these is that it happens randomly and this time not just on form  
submitting. An example of this is on the Ajax part generated by  
periodically\_call\_remote function on ruby that calls on a function that  
has nothing to do with the database. I did check the log files and found  
out that again it sends out only the authenticity\_token where it suppose  
to send the controller and action also. Weird thing is I can’t figure  
out how and when this happen. I also notice that this only occurs on  
POST requests only but that happens at a random events.

The bad thing about this is once the error occur, all the POST request  
causes the same error for all session users. That makes also logging-in  
on the application impossible. For me to make it work again, I usually  
kill all dispatch.fcgi process.

I just hope you or someone can help me figure out this problem since  
this one is urgent…☹

Thanks,  
Aj

kannav rajeev wrote:

> See on the database is there is any row with out id  
> if not then pass id to controller by this  
> :id = object.id
> 
> On Tue, Mar 2, 2010 at 9:58 AM, ajibanda [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > Ruby 1.8.6  
> > DEFjY291bnQTOgpAY2hhdDA6HEBuZXdfcmVjb3JkX2JlZm9yZV9zYXZlMDoP  
> > IEFjdGl2ZVN1cHBvcnQ6OlRpbWVXaXRoWm9uZVsIdTsHDSqIG4AAACBEIgtU  
> > b24iACIHaWQiBjEiCnBob25lIi0oNjMpICgwNDUpIDMyMi02OTY2LCAoNjMp  
> > NameError (uninitialized constant  
> > 80:in `request_parameters' /vendor/rails/actionpack/lib/action_controller/dispatcher.rb: `dispatch’  
> > /usr/lib/ruby/gems/1.8/gems/fcgi-0.8.8/lib/fcgi.rb:609:in `each’
> > 
> > [sudo] killall -TERM dispatch.fcgi  
> > To post to this group, send email to removed\_email\_address@domain.invalid.  
> > To unsubscribe from this group, send email to  
> > removed\_email\_address@domain.invalid[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> > .  
> > For more options, visit this group at  
> > [http://groups.google.com/group/rubyonrails-talk?hl=en](http://groups.google.com/group/rubyonrails-talk?hl=en).
> 
> –  
> Thanks:  
> Rajeev sharma

---

<div class="post-metadata">

**Author:** ![ajibanda](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a8b319/32.png) [@ajibanda](https://www.ruby-forum.com/u/ajibanda)\
**Post date:** [March 5, 2010, 3:30am UTC](https://www.ruby-forum.com/t/controllers-not-passed-as-a-parameter-causing-an-error/184423/4 "2010-03-05T03:30:34Z")

</div>

I did some checking on this and found out a line in vendor/rails/  
action/pack/lib/action\_controller/cgi\_process.rb that goes like this

raw\_post.force\_encoding(Encoding::BINARY) if raw\_post.respond\_to?  
(:force\_encoding)

I commented this out and the application seems to work now, but I’m  
not sure what this line is for… Can someone tell me?

TIA!
