Q:

ActionController::ParameterMissing Don't know whats wrong

I keep getting this error, I haven't used ruby in a while so I don't really know how to fix it.
param is missing or the value is empty: sch

Extracted source (around line #72):
70
71
72
73
74

    # Never trust parameters from the scary internet, only allow the white list through.
    def sch_params
      params.require(:sch).permit(:date, :time, :user_id)
    end
end

Rails.root: C:/Sites/web

Application Trace | Framework Trace | Full Trace
app/controllers/sches_controller.rb:72:in `sch_params'
app/controllers/sches_controller.rb:27:in `create'
Request

Parameters:

{"utf8"=>"✓",
 "authenticity_token"=>"cHq54V7aVCjeBz0udZAYjGiojgrqDANx/BS+oMQ+N+0=",
 "sche"=>{"date(1i)"=>"2014",
 "date(2i)"=>"4",
 "date(3i)"=>"21",
 "time(1i)"=>"2014",
 "time(2i)"=>"4",
 "time(3i)"=>"21",
 "time(4i)"=>"17",
 "time(5i)"=>"37",
 "user"=>"steve"},
 "commit"=>"Create Sche"}

This is my controller 
class SchesController < ApplicationController
  before_action :set_sch, only: [:show, :edit, :update, :destroy]

  # GET /sches
  # GET /sches.json
  def index
    @sches = Sche.all
  end

  # GET /sches/1
  # GET /sches/1.json
  def show
  end

  # GET /sches/new
  def new
    @sch = Sche.new
  end

  # GET /sches/1/edit
  def edit
  end

  # POST /sches
  # POST /sches.json
  def create
    @sch = Sche.new(sch_params)

    respond_to do |format|
      if @sch.save
        format.html { redirect_to @sch, notice: 'Sche was successfully created.' }
        format.json { render :show, status: :created, location: @sch }
      else
        format.html { render :new }
        format.json { render json: @sch.errors, status: :unprocessable_entity }
      end
    end
  end

  # PATCH/PUT /sches/1
  # PATCH/PUT /sches/1.json
  def update
    respond_to do |format|
      if @sch.update(sch_params)
        format.html { redirect_to @sch, notice: 'Sche was successfully updated.' }
        format.json { render :show, status: :ok, location: @sch }
      else
        format.html { render :edit }
        format.json { render json: @sch.errors, status: :unprocessable_entity }
      end
    end
  end

  # DELETE /sches/1
  # DELETE /sches/1.json
  def destroy
    @sch.destroy
    respond_to do |format|
      format.html { redirect_to sches_url }
      format.json { head :no_content }
    end
  end

  private
    # Use callbacks to share common setup or constraints between actions.
    def set_sch
      @sch = Sche.find(params[:id])
    end

    # Never trust parameters from the scary internet, only allow the white list through.
    def sch_params
      params.require(:sch).permit(:date, :time, :user)
    end
end

I don't really know whats going on, I've tried googleing the problem but I still haven't found the answer
Any help would be appreciated, thanks

A:

Use this:
   def sch_params
      params.require(:sche).permit(:date, :time, :user)
    end

Your controller name is SchesController so in params hash you are getting key sche and not sch.
If you look at the params generated, notice sche

"sche"=>{"date(1i)"=>"2014",  "date(2i)"=>"4",  "date(3i)"=>"21", 
  "time(1i)"=>"2014",  "time(2i)"=>"4",  "time(3i)"=>"21", 
  "time(4i)"=>"17",  "time(5i)"=>"37",  "user"=>"steve"}

