Ruby on Rails 使用 Cookie 的方法
01
class
?HelloController < ApplicationController
02
??????
def
?set_cookie
03
????????????
cookies[
:my_name
] =?
"AAAA"
04
????????????
redirect_to?
:action
?=>?
"show_cookie"
05
??????
end
06
??????
def
?show_cookie
07
????????????
my_name = cookies[
:my_name
]
08
????????????
render(
:text
?=>?
"Hello #{my_name}!"
)
09
??????
end
10
end