2

我在节目中设置了一个会话 var :time_block_id。提交表单后,您会看到相同的 session_id 和 _csrf_token 但 :time_block_id 消失了。有任何想法吗?导轨 3.2.6

控制器.rb

def show
  session[:time_block_id] = "test"
  debugger
  (rdb:663) p session 
  # outputs ...
  {"session_id"=>"1232115b1ffe78b7e71163e4bd48974a", "user_return_to"=>"/app/admin/clients", "_csrf_token"=>"/aFAp07yrpQtjgXDS2HQk+uNZLD3QuGRzSGX4Mszyug=", "warden.user.user.key"=>["User", [2], "$2a$10$1Mn/Riq9WdmnUUUiVhXbsO"], "time_block_id"=>"test"}

  render_wizard
end

def update
  debugger
  (rdb:663) p session
{"session_id"=>"1232115b1ffe78b7e71163e4bd48974a", "user_return_to"=>"/app/admin/clients", "_csrf_token"=>"/aFAp07yrpQtjgXDS2HQk+uNZLD3QuGRzSGX4Mszyug=", "warden.user.user.key"=>["User", [2], "$2a$10$1Mn/Riq9WdmnUUUiVhXbsO"]}

  a = ""
end

_form.html.haml

=simple_form_for @time_block, url: wizard_path, :method => :put do |f|
    =f.submit "go" 
4

1 回答 1

0

我建议您将“time_block_id”变量移到“warden.user.user.key”之前,并检查游览模型。前一个参数上的错误更有可能在没有错误消息的情况下阻塞其余进程。

于 2012-07-26T17:39:27.560 回答