2010/7/26 Pål Bergström <li...@ruby-forum.com>: > Sorry but I don't understand you. And I have a feeling you don't > understand me. > > Let me ask you this instead; is there a way to get the value of a cookie > in a model?
That breaks encapsulation. The model should never care what your cookies are doing. Only controllers should care about cookies. That being said.. When you use the model to create an instance of an ActiveRecord object, generally you will pass in the params from a form, something like this: User.create( params[:user] ) params is a type of hash, and Hash has merge. So you can add stuff to the params before passing it to the model, something like: params.merge( :my_cookie => cookies[:my_cookie] ) -- Greg Donald destiney.com | gregdonald.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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.