Is Rails cookies method in view and controller diffrent?

rails 1.2.3

code :
in controller:

cookies[:test] = 1
@cookies = cookies

in view:

<%[email protected][:test].class.to_s%>
<%=cookies[:text].class.to_s%>

output:
String Array

[email protected] wrote:

in view:

<%[email protected][:test].class.to_s%>
<%=cookies[:text].class.to_s%>

output:
String Array

Did you type that in wrong? You have two different key names there.

ā€“
Michael W.

Guest wrote:

rails 1.2.3

code :
in controller:

cookies[:test] = 1
@cookies = cookies

in view:

<%[email protected][:test].class.to_s%>
<%=cookies[:text].class.to_s%>

output:
String Array

sorry , type wrong

the cookies in view is a Hash
the cookies in controller is a ActionController::CookieJar

now , how to use cookies in the view?
thank you.

Michael W. wrote:

[email protected] wrote:

in view:

<%[email protected][:test].class.to_s%>
<%=cookies[:text].class.to_s%>

output:
String Array

Did you type that in wrong? You have two different key names there.

ā€“
Michael W.

thank you .
your name looks like a chinese , and iā€™m too.
nice to meet you.

i was resolved this issure:

in controllers/application.rb

add a class method

helper_method :cookies

the cookies method in view will work correct.