Okay. I was cruising a long with a simple rails 4 app, and all of the sudden I am getting an exception, and info is not being stored in database.
Controller-
def new @game = Game.new end
def create @game = Game.new(game_params) if @game.save redirect_to @game, notice: "Game Created" else render :new end end
def destroy @game = Game.find(params[:id]) @game.destroy redirect_to root_path, notice: "Game was removed." end
def edit @game = Game.find(params[:id]) end
def update @game = Game.find(params[:id]) if @game.update(game_params) redirect_to @game, notice: "Game was updated" else render :edit end end
private
def game_params params.require(:game).permit(:location, :date, :time) end end
form - <%= form_for(@game) do |f| %>
<p> <%= f.label :location %>
<%= f.text_field :location %>
</p>
<p> <%= f.label :date %>
<%= f.date_field :date %>
</p>
<p> <%= f.label :time %>
<%= f.time_field :time, {ampm: true} %>
</p>
<p>
<%= f.submit %> | <%= link_to "Cancel", @game %>
</p>
<% end %>