rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org
2007-Mar-28 10:26 UTC
is Rails cookies method in view and controller diffrent?
rails 1.2.3 code : in controller: cookies[:test] = 1 @cookies = cookies in view: <%=@cookies[:test].class.to_s%> <%=cookies[:text].class.to_s%> output: String Array -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Michael Wang
2007-Mar-28 10:30 UTC
Re: is Rails cookies method in view and controller diffrent?
rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org wrote:> rails 1.2.3 > > > code : > in controller: > > cookies[:test] = 1 > @cookies = cookies > > > > in view: > > <%=@cookies[:test].class.to_s%> > <%=cookies[:text].class.to_s%> > > > output: > String ArrayDid you type that in wrong? You have two different key names there. -- Michael Wang --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org
2007-Mar-28 10:51 UTC
Re: is Rails cookies method in view and controller diffrent?
Guest wrote:> rails 1.2.3 > > > code : > in controller: > > cookies[:test] = 1 > @cookies = cookies > > > > in view: > > <%=@cookies[:test].class.to_s%> > <%=cookies[:text].class.to_s%> > > > output: > String Arraysorry , 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. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org
2007-Mar-28 10:57 UTC
Re: is Rails cookies method in view and controller diffrent?
Michael Wang wrote:> rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org wrote: >> >> in view: >> >> <%=@cookies[: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 Wangthank 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. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---