0

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 %>

Reeder32
  • 89
  • 4
  • what is the exact exception? – Anchor May 21 '14 at 00:30
  • http://localhost:3000/games/new?utf8=%E2%9C%93&authenticity_token=cLRLQ66BxEjbI%2Fz15EtZtiENS2RSJ9OQEY4gYUQ7OrU%3D&game%5Blocation%5D=&game%5Bdate%5D=&game%5Btime%5D=&commit=Create+Game – Reeder32 May 21 '14 at 16:52

0 Answers0