ruby-on-rails - Ruby on Rails - 参数丢失或值为空
问题描述
我正在为我的 rails 应用程序寻求帮助:
当我尝试在控制器下方的基于地标上创建估计时出现错误
def create
@landmark = Landmark.find(params[:landmark_id])
@estimate = Estimate.new(estimate_params)
@estimate.landmark = @landmark
@estimate.price = @landmark.price
if @estimate.save
# Deliver the signup email
NotificationMailer.create_project(@estimate).deliver
redirect_to landmark_path(@landmark, :notice => 'Booking created')
else
redirect_to landmark_path(@landmark, :notice => 'Error during creation')
end
end
用我的参数:
def estimate_params
params.require(:estimate).permit(:price)
end
我不明白为什么我的参数价格丢失了。
参数丢失或值为空:估计
预先感谢您的帮助
解决方案
推荐阅读
- javascript - JavaScript 正则表达式匹配数学表达式
- reactjs - 向 Mobx 可观察数组添加动作
- firebase - 验证 Firebase 注册令牌
- asp.net - 跨域导出 RSA 容器密钥容器
- amazon-web-services - Can cognito sign-in verification email contain image?
- javascript - onClick 没有响应
- python - 获取循环的迭代以在同一行上输出
- java - 系统运行时更新 Java
- python - 根据 Python 中 NaN 发生的时间,通过“填充”和“插值”填充 NaN
- php - PHP无法在干净的网址上传递问号