2
我在show中設置了一個會話var:time_block_id。 提交表單時,您會看到相同的session_id和_csrf_token,但time_block_id已消失。有任何想法嗎? 的Rails 3.2.6表單提交後會話變量從會話中刪除
controller.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"