flornet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Nov-30 13:19 UTC
Using cookies in a model
Well, let''s say I have an Article class. What I would like is being
able to define a method like that :
def rated?
if cookies["rate-article-#{self.id.to_s}"] == "rated"
true
else
false
end
end
So that I can use it in my views to check if the current user has
rated this article or not.
BUT the "cookies" method isn''t defined for ActiveRecord::Base
I tryied to include many modules (ActionController::Cookies ,
ActionController::Helper, ...) and cannot succeed.
Any help is welcome.
Thanks,
Florent J.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---