我有以下代码,基本上我想在第一次提交表单时保存cookie,下次从cookie中读取以填充表单。
def new
@detail = Detail.new(cookies[:detail])
end
创建方法有
def create
@detail = Detail.new(params[:detail])
if @detail.save
cookies[:detail] = {
value: params[:detail],
expires: 30.days.from_now
}
redirect_to confirmation_path
else
render 'new'
end
end
我收到错误:
undefined method `reject' for #<String:0x007fbf5486ac48>