Just FYI. My apologies if this has already been discussed previously. This is a new "feature" of 11.1, as this only appeared after I updated. If you are using <%= form_tag :action => ''whatever'' %> in your views and you get this error: <NoMethodError: private method `split'' called for nil:NilClass> then make sure you are sending at least 1 parameter in your form. The form_tag defaults to method="post", and now it appears the assumption is made that at least one parameter will arrive. I had a few instances where I submit a form with no parameters to create a new item of some sort. If the form is submitted as an http "get", or you submit at least 1 parameter on the post, there is no error.
This has already been fixed in ticket #1001 . Although I could fix it, I didn''t now the exact situation it would break in, but that''s clear now: empty posts were not allowed. Kind regards, Flurin Egger Matthew Thill wrote:> Just FYI. My apologies if this has already been discussed previously. > > This is a new "feature" of 11.1, as this only appeared after I > updated. If you are using <%= form_tag :action => ''whatever'' %> in > your views and you get this error: > <NoMethodError: private method `split'' called for nil:NilClass> > > then make sure you are sending at least 1 parameter in your form. The > form_tag defaults to method="post", and now it appears the assumption > is made that at least one parameter will arrive. I had a few instances > where I submit a form with no parameters to create a new item of some > sort. > > If the form is submitted as an http "get", or you submit at least 1 > parameter on the post, there is no error. > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Flurin Egger wrote:> This has already been fixed in ticket #1001 . Although I could fix it, > I didn''t now the exact situation it would break in, but that''s clear > now: empty posts were not allowed.I am trying to run the Four Days on Rails example on 0.11.1, and finding lots of things that need to be changed. This is one of them: the ToDo items list page uses a form with no fields, with a submit button for adding a new item, and submitting the form results in: Application error Rails application failed to start properly (not a very good message - this is a FastCGI process failing) The fastcgi.crash.log shows: [Sat Apr 09 20:20:25 GMT Daylight Time 2005] Dispatcher failed to catch: private method `split'' called for nil:NilClass (NoMethodError) C:/ruby/lib/ruby/1.8/cgi.rb:896:in `parse'' C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.7.0/lib/action_controller/cgi_ext/raw_post_data_fix.rb:14:in `initialize_query'' C:/ruby/lib/ruby/1.8/cgi.rb:2269:in `initialize'' (eval):16:in `initialize'' C:/ruby/lib/ruby/site_ruby/1.8/fcgi.rb:600:in `new'' C:/ruby/lib/ruby/site_ruby/1.8/fcgi.rb:600:in `each_cgi'' C:/ruby/lib/ruby/site_ruby/1.8/fcgi.rb:597:in `each'' C:/ruby/lib/ruby/site_ruby/1.8/fcgi.rb:597:in `each_cgi'' D:/www/webroot/ToDo/public/dispatch.fcgi:18 FCGI process 652 killed by this error This is *not* the situation fixed by your patch (line 14 in raw_post_data_fix.rb, whereas your patch applies to line 40). Adding a hidden field to the form fixes the problem. regards Justin> Matthew Thill wrote: > >> Just FYI. My apologies if this has already been discussed previously. >> >> This is a new "feature" of 11.1, as this only appeared after I >> updated. If you are using <%= form_tag :action => ''whatever'' %> in >> your views and you get this error: >> <NoMethodError: private method `split'' called for nil:NilClass> >> >> then make sure you are sending at least 1 parameter in your form. The >> form_tag defaults to method="post", and now it appears the assumption >> is made that at least one parameter will arrive. I had a few instances >> where I submit a form with no parameters to create a new item of some >> sort. >> >> If the form is submitted as an http "get", or you submit at least 1 >> parameter on the post, there is no error.
Are you sure? Because it looks to me, that the problem is still the same: CGI::parse gets passed a nil value, because "read_query_parameters" returns nil where it should return an empty string. Did you try to apply my patch (or just add the .to_s for that matter)? Kind regards, Flurin Egger Justin Forder wrote:> Flurin Egger wrote: > >> This has already been fixed in ticket #1001 . Although I could fix >> it, I didn''t now the exact situation it would break in, but that''s >> clear now: empty posts were not allowed. > > > I am trying to run the Four Days on Rails example on 0.11.1, and finding > lots of things that need to be changed. This is one of them: the ToDo > items list page uses a form with no fields, with a submit button for > adding a new item, and submitting the form results in: > > Application error > Rails application failed to start properly > > (not a very good message - this is a FastCGI process failing) > > The fastcgi.crash.log shows: > > [Sat Apr 09 20:20:25 GMT Daylight Time 2005] Dispatcher failed to > catch: private method `split'' called for nil:NilClass (NoMethodError) > C:/ruby/lib/ruby/1.8/cgi.rb:896:in `parse'' > > C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.7.0/lib/action_controller/cgi_ext/raw_post_data_fix.rb:14:in > `initialize_query'' > C:/ruby/lib/ruby/1.8/cgi.rb:2269:in `initialize'' > (eval):16:in `initialize'' > C:/ruby/lib/ruby/site_ruby/1.8/fcgi.rb:600:in `new'' > C:/ruby/lib/ruby/site_ruby/1.8/fcgi.rb:600:in `each_cgi'' > C:/ruby/lib/ruby/site_ruby/1.8/fcgi.rb:597:in `each'' > C:/ruby/lib/ruby/site_ruby/1.8/fcgi.rb:597:in `each_cgi'' > D:/www/webroot/ToDo/public/dispatch.fcgi:18 > FCGI process 652 killed by this error > > This is *not* the situation fixed by your patch (line 14 in > raw_post_data_fix.rb, whereas your patch applies to line 40). > > Adding a hidden field to the form fixes the problem. > > regards > > Justin > >> Matthew Thill wrote: >> >>> Just FYI. My apologies if this has already been discussed previously. >>> >>> This is a new "feature" of 11.1, as this only appeared after I >>> updated. If you are using <%= form_tag :action => ''whatever'' %> in >>> your views and you get this error: >>> <NoMethodError: private method `split'' called for nil:NilClass> >>> >>> then make sure you are sending at least 1 parameter in your form. >>> The form_tag defaults to method="post", and now it appears the >>> assumption is made that at least one parameter will arrive. I had a >>> few instances where I submit a form with no parameters to create a >>> new item of some sort. >>> >>> If the form is submitted as an http "get", or you submit at least 1 >>> parameter on the post, there is no error. >> > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Flurin Egger wrote:> Are you sure? Because it looks to me, that the problem is still the > same: CGI::parse gets passed a nil value, because > "read_query_parameters" returns nil where it should return an empty string. > > Did you try to apply my patch (or just add the .to_s for that matter)?Well, I believed what I saw in the log. But I shall try putting in the .to_s, and come back to you. regards Justin
Flurin Egger wrote:> Are you sure? Because it looks to me, that the problem is still the > same: CGI::parse gets passed a nil value, because > "read_query_parameters" returns nil where it should return an empty string. > > Did you try to apply my patch (or just add the .to_s for that matter)?Flurin - apologies for not having read the code properly before responding before. I hand-patched your change and it fixed the problem. (And when I looked at the code today to apply the patch, I could see that it would do the trick.) Sorry for the delay - too much work (I''m only trying Rails in my free time). regards Justin