I am pulling my hair out on this. It seems like it should be the easiest
thing in the world to do, but it's just escaping me.
I have a rails built form and but I keep getting this error when I
"Mysql::Error: Column 'user_id' cannot be null: INSERT INTO `games`
I have a hidden field in my form that collects @user.id which is passed
by the controller.
<% form_for @game, :url => user_games_path(@user), :method => :post do
<%= f.hidden_field :user_id, :value => @user.id %>
<%= f.label :my_user_empire %>
<%= f.select :user_empire,
<%=f.submit "Begin Game" %>
<% end %>
@user = User.find(params[:user_id])
@game = Game.new
And I am pretty sure the problem is b/c the HTML hidden field is sending
the database a string and the DB is expecting an integer.
I've tried this in the model:
but I get the error:
"stack level too deep"
I would greatly appreciate any help. Thank you.