I'm having trouble with my form tag in my app.
I have a form_tag on my user/show page. The following code does not deliver any errors, however it is not writing to the database. From what I can tell I need to add @position_game_stat somewhere to my form_tag, because my form is taking the data as nil.
user/show.html.erb
<%= form_tag({:controller => "position_game_stats", :action => "create"}, :method => "post") do %>
<%= label_tag :at_bats %><br />
<%= number_field_tag :at_bats %>
<%= submit_tag("submit") %>
<% end %>
position_game_stats controller under create
@position_game_stat = PositionGameStat.new(params[:position_game_stat])
Here is the server log
Started POST "/position_game_stats" for 127.0.0.1 at 2013-06-20 17:55:47 -0500 Processing by PositionGameStatsController#create as HTML Parameters: {"utf8"=>"✓", "authenticity_token"=>"C2FJNDfVPILGx05DI2XqRO5wjC79Of7W4SoLvVpnh+4=", "user_id"=>"{:value=>1}", "date"=>{"year"=>"2013", "month"=>"6", "day"=>"20"}, "at_bats"=>"666", "hits"=>"6", "runs"=>"6", "doubles"=>"6", "triples"=>"6", "homeruns"=>"6", "steals"=>"6", "walks"=>"6", "strike_outs"=>"6", "commit"=>"submit"} (0.1ms) begin transaction SQL (0.5ms) INSERT INTO "position_game_stats" ("at_bats", "created_at", "date", "doubles", "hits", "homeruns", "runs", "steals", "strike_outs", "triples", "updated_at", "user_id", "walks") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [["at_bats", nil], ["created_at", Thu, 20 Jun 2013 22:55:47 UTC +00:00], ["date", nil], ["doubles", nil], ["hits", nil], ["homeruns", nil], ["runs", nil], ["steals", nil], ["strike_outs", nil], ["triples", nil], ["updated_at", Thu, 20 Jun 2013 22:55:47 UTC +00:00], ["user_id", nil], ["walks", nil]] (163.5ms) commit transaction User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1
Thanks in advanced...