I'm having trouble with my form tag in my app.
I have a form_tag user / show page The following code does not distribute any errors, although this database is not written. What can I say that I have to add @ position_game_stat to my form_tag from somewhere because my form is taking data as zero.
user / show.html.erb
& lt;% = form_tag ({: controller = & gt; "position_game_stats",: action => "},: Method = & gt;" post ")% & gt; & lt;% = label_tag: at_bats% & gt; & Lt; Br / & gt; & lt;% = number_field_tag: at_bats% & gt; & lt;% = submit_tag ("submit")%> & lt;% end% & gt; position_game_stats created under the controller
@position_game_stat = PositionGameStat.new (parameter [: position_game_stat])
server log on
Start Post "/ position_game_stats authenticity_token a ????" "; UTF8" = & gt "" = & gt; "C2FJNDfVPILGx05DI2XqRO5wjC79Of7W4SoLvVpnh:" 2013- the PositionGameStatsController # on { 06-20 17:55:47 -0500 "": "{: value = & gt; 1}", "date" to create 127.0.0.1 as the HTML parameters for processing "= & Gt; = "6", "6", "Hit" =>, "6", "Run" =>, "6", " "6", "at_bats" => "6", "Homeran" => "6", "steals" => "6", "walks" = & gt; gt; "6", "strike_outs" = & gt; "6", "triples" = & gt; "Committee" = & gt; "Submit"} (0.1ms) transactions start SQL (0.5ms) INSERT " In the situation, _game_stats "(" at_bats "," created_at "," date_ "," couple "," hits "," homeruns "," run "," steals "," strike_outs "," triple "," updated_at "," User_id "," walks ") value (?,?,?,?,?,?,?,?,?,?) [[" At_bats ", zero], [" created ", Thursday, June 20, 2013 22:55:47 UTC + 00: 00], [ "date", null], [ "doubles", null], [ "hit" zero], [ "Homrn" zero], [ " UTC + 00 "," "zero"], ["strike", zero], ["strik_outs", zero], ["triples", zero], ["update_at", Thursday, 20 June 2013 22:55:47 : "[User_id", zero], ["walks", nil]] (163.5ms) committed transaction user load (0.2ms) SELECT "users". * "Users" from "user" WHERE "." "Id "= 1 LIMIT 1
thanks in advanced ...
I think you can use the form for the tag.
View
& lt;% = form_for @position_game_stat do F | & Gt%; & Lt;% = f.number_field: at_bats% & gt; & Lt;% = f.submit% & gt; & Lt;% end% & gt; controller
def new @ position_game_stat = position Gemstat. New end
No comments:
Post a Comment