I have a situation where no params are being sent when the form is submitted. After the rendering this is the html that I get... <form action="/stats/new" method="post"> Height: <input id="stat_height_ft" name="stat[height_ft]" size="5" type="text" />ft </p> Weight: <input id="stat_weight_lbs" name="stat[weight_lbs]" size="5" type="text" />lbs </p> <input name="commit" type="submit" value="Save" /> </form> Why would this result in a GET not a POST and no params being sent? -- Posted via http://www.ruby-forum.com/.
Hello Todd, What does your ''tail -f log/development.log'' show ? I dare say that the form is posting fine, but your ruby inside the target controller /stats/new is not expecting the hashes of hashes format* Regards Stef (* NB: I have been wrong before, could be wrong now, and will continue to be wrong in the future ;) Todd S. wrote:> I have a situation where no params are being sent when the form is > submitted. > > After the rendering this is the html that I get... > > <form action="/stats/new" method="post"> > Height: <input id="stat_height_ft" name="stat[height_ft]" size="5" > type="text" />ft </p> > Weight: <input id="stat_weight_lbs" name="stat[weight_lbs]" size="5" > type="text" />lbs </p> > <input name="commit" type="submit" value="Save" /> > </form> > > > Why would this result in a GET not a POST and no params being sent? > >
more info... For some reason. Only a link to {:controller => ''account'', :action => ''login''} will actually [POST]. If I change the link to something else i.e. {:controller => ''stats'', :action => ''new''} this will result in a [GET] Whay is that? -- Posted via http://www.ruby-forum.com/.
Todd S. wrote:> more info... > > For some reason. Only a link to {:controller => ''account'', :action => > ''login''} will actually [POST]. If I change the link to something else > i.e. {:controller => ''stats'', :action => ''new''} this will result in a > [GET] > > Whay is that? > >Sorry, I have not seen the rest of your thread, but can you check the top of your controller file? You may have something like this in your file: # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html) verify :method => :post, :only => [ :destroy, :create, :update ], :redirect_to => { :action => :list } I''m not sure but that may be the reason why only certain types of forms are being posted.. but I''m not sure! :) Cheers Mohit.
my results are different between the production (seperately hosted) site and the development site which is local to myself. here is a tail of the various logs. First selecting the loging link then the stats link. All I''ve done is change the controller and action parameters. On the Production host... first :controller=>''account'', :action=>''login'' then :controller=>''stats'', :action=>''new'' Processing AccountController#login (for 24.130.33.165 at 2006-08-12 13:57:51) [POST] Session ID: 112649adcdb5ca0c290e549fb87120b9 Parameters: {"action"=>"login", "controller"=>"account", "null"=>""} Rendering account/login Completed in 0.05741 (17 reqs/sec) | Rendering: 0.01350 (23%) | DB: 0.03850 (67%) | 200 OK Processing StatsController#new (for 24.130.33.165 at 2006-08-12 13:59:28) [GET] Session ID: 112649adcdb5ca0c290e549fb87120b9 Parameters: {"action"=>"new", "controller"=>"stats"} Completed in 0.01058 (94 reqs/sec) | DB: 0.00213 (20%) | 200 OK [http://thezuke.net/stats/new] _______________________ on the development host everything works fine. I have the same version of ruby and rails on both machines. Processing AccountController#login (for 127.0.0.1 at 2006-08-12 14:02:11) [POST] Session ID: e5a8904dd66379df002779de8a2afcd8 Parameters: {"action"=>"login", "controller"=>"account"} User Columns (0.000674) SHOW FIELDS FROM users SQL (0.000944) SELECT count(*) AS count_all FROM users Rendering account/login Completed in 0.02595 (38 reqs/sec) | Rendering: 0.00496 (19%) | DB: 0.00162 (6%) | 200 OK Processing StatsController#new (for 127.0.0.1 at 2006-08-12 14:03:19) [POST] Session ID: e5a8904dd66379df002779de8a2afcd8 Parameters: {"action"=>"new", "controller"=>"stats"} User Load (0.000844) SELECT * FROM users WHERE (users.id = 1) LIMIT 1 Rendered stats/_newStatInfo (0.02914) Completed in 0.05540 (18 reqs/sec) | DB: 0.00084 (1%) | 200 OK -- Posted via http://www.ruby-forum.com/.
Hello Todd, You know, the first thought that struck me was, if these systems are the same (codebase wise) and the controllers and routes is the same, and your probably on a -shared- hosting enviroment, maybe the host provider is already grabbing requests for ''stats'' to your domain/machine before it even gets to your webserver/rails ? Much like trying to use a ''reserved'' keyword for a class in ruby or a tablename in postgreSQL (create table null as ..). For humour sake, I would try re-naming the controller from stats to something totally un-ambiguous like ''mygroovystats'' (or such forth). I dare say that this problem will go away at that point ;) Let us all know how it goes either way. Regards Stef Todd S. wrote:> my results are different between the production (seperately hosted) site > and the development site which is local to myself. > > here is a tail of the various logs. First selecting the loging link > then the stats link. All I''ve done is change the controller and action > parameters. > > On the Production host... first :controller=>''account'', :action=>''login'' > then :controller=>''stats'', :action=>''new'' > > Processing AccountController#login (for 24.130.33.165 at 2006-08-12 > 13:57:51) [POST] > Session ID: 112649adcdb5ca0c290e549fb87120b9 > Parameters: {"action"=>"login", "controller"=>"account", "null"=>""} > Rendering account/login > Completed in 0.05741 (17 reqs/sec) | Rendering: 0.01350 (23%) | DB: > 0.03850 (67%) | 200 OK > > Processing StatsController#new (for 24.130.33.165 at 2006-08-12 > 13:59:28) [GET] > Session ID: 112649adcdb5ca0c290e549fb87120b9 > Parameters: {"action"=>"new", "controller"=>"stats"} > Completed in 0.01058 (94 reqs/sec) | DB: 0.00213 (20%) | 200 OK > [http://thezuke.net/stats/new] > > _______________________ > on the development host everything works fine. I have the same version > of ruby and rails on both machines. > > Processing AccountController#login (for 127.0.0.1 at 2006-08-12 > 14:02:11) [POST] > Session ID: e5a8904dd66379df002779de8a2afcd8 > Parameters: {"action"=>"login", "controller"=>"account"} > User Columns (0.000674) SHOW FIELDS FROM users > SQL (0.000944) SELECT count(*) AS count_all FROM users > Rendering account/login > Completed in 0.02595 (38 reqs/sec) | Rendering: 0.00496 (19%) | DB: > 0.00162 (6%) | 200 OK > > > Processing StatsController#new (for 127.0.0.1 at 2006-08-12 14:03:19) > [POST] > Session ID: e5a8904dd66379df002779de8a2afcd8 > Parameters: {"action"=>"new", "controller"=>"stats"} > User Load (0.000844) SELECT * FROM users WHERE (users.id = 1) LIMIT > 1 > Rendered stats/_newStatInfo (0.02914) > Completed in 0.05540 (18 reqs/sec) | DB: 0.00084 (1%) | 200 OK > >