0
我一直得到这个错误,我没有在一段时间内使用红宝石,所以我真的不知道如何解决它。ActionController :: ParameterMissing不知道什么是错的
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"}
这是我的控制器
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
我真的不知道怎么回事,我已经试过googleing的问题,但我还没有找到答案 任何帮助,将不胜感激感谢
啊这太尴尬了,我不敢相信我错过了。非常感谢你 – user3018763
很高兴提供帮助。 15分钟超时结束后请接受答案。 :) –