Why doesn''t this work in a controller, or in a file in a module in /lib: require ''cgi'' cgi = CGI.new test = cgi.cookies["mycookie"][0] cgi.cookies doesn''t get the cookie. But this cgi script does: require ''cgi'' cgi = CGI.new(''html4'') cookie_name = ''mycookie'' val_string = cgi.cookies[cookie_name][0] cgi.out { cgi.html { cgi.head { cgi.title {"Cookies"} } + cgi.body { cgi.p {"name: #{cookie_name}" } + cgi.p {"value: #{val_string}"} } } } -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Jul 9, 10:44 am, Pål Bergström <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Why doesn''t this work in a controller, or in a file in a module in /lib: > > require ''cgi'' > cgi = CGI.new > test = cgi.cookies["mycookie"][0] >Rails doesn''t use CGI anymore as the interface between it and the outside world (it uses rack instead) which probably broke that. Controllers have an instance method called cookies which returns a hash like object containing your cookies. Fred> cgi.cookies doesn''t get the cookie. > > But this cgi script does: > > require ''cgi'' > cgi = CGI.new(''html4'') > cookie_name = ''mycookie'' > val_string = cgi.cookies[cookie_name][0] > cgi.out { > cgi.html { > cgi.head { cgi.title {"Cookies"} } + > cgi.body { > cgi.p {"name: #{cookie_name}" } + > cgi.p {"value: #{val_string}"} > } > }} > > -- > Posted viahttp://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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Frederick Cheung wrote: s doesn''t use CGI anymore as the interface between it and the> outside world (it uses rack instead) which probably broke that. > > Controllers have an instance method called cookies which returns a > hash like object containing your cookies. > > FredI see. Strange that it works on my machine locally. I regularly use rails cookie instance in my rails app. But I can''t use it in a module in a file in /app/lib, right? That''s why I used cgi. The thing is, before save and show I encrypt certain fields in the database using the gem fast_aes, and the key is in a cookie. In each model I use before_save and after_find. How can I get the value of that cookie without using cgi? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Frederick Cheung wrote:> uses rackHow do I read a cookie with rack? Trying to find the answer through Google but witout luck. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 09 Jul 2010, at 13:56, Pål Bergström wrote:>> uses rack > > How do I read a cookie with rack? Trying to find the answer through > Google but witout luck.This should help: http://github.com/dewind/rack-cookie-monster/blob/master/lib/rack/cookie_monster.rb Best regards Peter De Berdt -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Peter De Berdt wrote:> On 09 Jul 2010, at 13:56, Pål Bergström wrote:> This should help: > > http://github.com/dewind/rack-cookie-monster/blob/master/lib/rack/cookie_monster.rb >It did. Just a stupid question :-) How do I use env? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 09 Jul 2010, at 14:27, Pål Bergström wrote:>> This should help: >> >> http://github.com/dewind/rack-cookie-monster/blob/master/lib/rack/cookie_monster.rb >> > > > It did. Just a stupid question :-) > > How do I use env?What do you mean? The environment is passed in with the required call method from the rack middleware. Best regards Peter De Berdt -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Peter De Berdt wrote:> What do you mean? The environment is passed in with the required call > method from the rack middleware.I don''t know. I just want to get a cookie value in a script in a file in railsapp/lib. I thought this would do it: req = Rack::Request.new(env) req.cookies() But I get "undefined local variable or method `env''" -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 09 Jul 2010, at 14:44, Pål Bergström wrote:>> What do you mean? The environment is passed in with the required call >> method from the rack middleware. > > I don''t know. I just want to get a cookie value in a script in a > file in > railsapp/lib. I thought this would do it: > > req = Rack::Request.new(env) > req.cookies() > > But I get "undefined local variable or method `env''"Well, to get started with middlewares, it''s a good thing to read up on how Rails is using it: http://guides.rails.info/rails_on_rack.html In your case, something like this would probably do the trick: http://gist.github.com/469445 That''s the basic structure. How you handle those cookies and what you want to do with it will determine how you pass it on into the Rails app. Google should be able to help you out there, since there''s lots of middlewares out there that will do something similar to what you want to do. Best regards Peter De Berdt -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Peter De Berdt wrote:> On 09 Jul 2010, at 14:44, Pål Bergström wrote:> Well, to get started with middlewares, it''s a good thing to read up on > how Rails is using it: > http://guides.rails.info/rails_on_rack.htmlToo much to get into now. And you script (thank you very much for you effort :-) ) is much more than what I''ve used before with cgi. require ''cgi'' cgi = CGI.new test = cgi.cookies["mycookie"][0] So, getting the value from a cookie into a model is that hard? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I would just like to get the value of a particular cookie in a file in /lib. Is there any other way without rack? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 09 Jul 2010, at 16:26, Pål Bergström wrote:> I would just like to get the value of a particular cookie in a file in > /lib. Is there any other way without rack?Why are you overcomplicating things so much? Cookies are part of the request/response cycle and have nothing to do with models (MVC remember, separation of logic). If you want to pass controller data into a model or a custom class, you pass it as a parameter. In case of your /lib file (which is a custom class I presume): class FooBar def initialize(mycookievariable) # do something with mycookievariable end def somemethod # etc. end end and in your controller: def show my_foo_bar = FooBar.new(cookies[:mycookievariable) end Best regards Peter De Berdt -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Peter De Berdt wrote:> Why are you overcomplicating things so much?Good question. :-) It''s so much easier when you have a "programmers" brain. I don''t. Thanks for your suggestion. But how do I get the value of a cookie in the model? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Peter De Berdt
2010-Jul-09 16:21 UTC
Re: Re: Re: Re: Re: Re: Problem with reading cgi cookie
On 09 Jul 2010, at 17:02, Pål Bergström wrote:>> Why are you overcomplicating things so much? > > Good question. :-) It''s so much easier when you have a "programmers" > brain. I don''t. > > Thanks for your suggestion. But how do I get the value of a cookie in > the model?You pass it as a parameter to the model method, just like I passed it into a custom class. class FooBar < ActiveRecord::Base def some_method(cookievalue) # do something here end end # In the controller FooBar.some_method(cookies[:myvalue]) Best regards Peter De Berdt -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Peter De Berdt
2010-Jul-09 16:25 UTC
Re: Re: Re: Re: Re: Re: Problem with reading cgi cookie
On 09 Jul 2010, at 17:02, Pål Bergström wrote:>> Why are you overcomplicating things so much? > > Good question. :-) It''s so much easier when you have a "programmers" > brain. I don''t. > > Thanks for your suggestion. But how do I get the value of a cookie in > the model?... or if you just want to make it a field value: # In controller def create MyModel.create(params[:my_model].merge(:some_field => cookies[:some_cookie])) end No need to juggle around and just mass-assign using a hash, like demonstrated above. Best regards Peter De Berdt -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Pål Bergström
2010-Jul-09 18:43 UTC
Re: Re: Re: Re: Re: Re: Problem with reading cgi cookie
Peter De Berdt wrote:> On 09 Jul 2010, at 17:02, Pål Bergström wrote: >> ... or if you just want to make it a field value: >That was smart. Thanks. :-) -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Pål Bergström wrote:> req = Rack::Request.new(env) > req.cookies() >I still have problem. I just want to read a damn cookie. Why doesn''t this work? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Pål Bergström wrote:> I still have problem. I just want to read a damn cookie. Why doesn''t > this work?def create @user = User.new(params[:user]) cookies[:user_name] = "david" .... .... end Sets a :user_name cookie with value "david" upon creating a user def index @users = User.all @cookie_count = cookies.size @user_name_cookie = cookies[:user_name] if @cookie_count > 0 .... .... end Reads the :user_name cookie when listing users. <p>There are <%= @cookie_count %> cookies in request.</p> <p>The :user_name cookie value is: <%= @user_name_cookie %></p> Show the number of cookies and the value of the :user_name cookie ("david"). Note: This is a useless contrived example showing use of the "cookies" method, but notice once you have the cookie value you can do whatever you want with it, including passing it into a model. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Robert Walker wrote:> > def create > @user = User.new(params[:user]) > cookies[:user_name] = "david" > .... > .... > end > > Sets a :user_name cookie with value "david" upon creating a user > > > def index > @users = User.all > @cookie_count = cookies.size > @user_name_cookie = cookies[:user_name] if @cookie_count > 0 > .... > .... > end > > Reads the :user_name cookie when listing users. > > <p>There are <%= @cookie_count %> cookies in request.</p> > <p>The :user_name cookie value is: <%= @user_name_cookie %></p> > > Show the number of cookies and the value of the :user_name cookie > ("david"). >I don''t want to set a cookie. That''s never been a problem. I would like to read a cookie and get the value into models so I can access it when using a before_save. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Pål Bergström wrote:>> def index >> @users = User.all >> @cookie_count = cookies.size >> @user_name_cookie = cookies[:user_name] if @cookie_count > 0 >> .... >> .... >> end > I don''t want to set a cookie. That''s never been a problem. I would like > to read a cookie and get the value into models so I can access it when > using a before_save.I though I had made that clear. You read the cookie value as shown in above index method of the controller then you pass that value to the model object. If you don''t know how to pass a variable to a method, then I''d suggest learning something about Ruby before you try to write a Rails application. I don''t know how to make this any more clear. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Robert Walker wrote:> Pål Bergström wrote:> I though I had made that clear. You read the cookie value as shown in > above index method of the controller then you pass that value to the > model object. > > If you don''t know how to pass a variable to a method, then I''d suggest > learning something about Ruby before you try to write a Rails > application. I don''t know how to make this any more clear.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? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
2010/7/26 Pål Bergström <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>:> 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Greg Donald wrote:> 2010/7/26 P�l Bergstr�m <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>:> 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] )That I know. I was hoping to do something similar to what I had before, when I could use cgi. Something easy using before_save and after_find. What I want to achieve is to aes encrypt selected columns in the database using a key stored in the users browser as a cookie. I do it ( or used to do it) like this. In each model I have a before_save and after_find. There I pass the value from the params, or from the database after find, to a module where the string was either encrypted or decrypted with the key stored in a cookie. That cookie was fetched with the help of cgi in the module. It worked great. But not now, as Rack is taking the place of cgi. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
2010/7/26 Pål Bergström <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>:> That I know. I was hoping to do something similar to what I had before, > when I could use cgi. Something easy using before_save and after_find. > > What I want to achieve is to aes encrypt selected columns in the > database using a key stored in the users browser as a cookie. I do it ( > or used to do it) like this. > > In each model I have a before_save and after_find. There I pass the > value from the params, or from the database after find, to a module > where the string was either encrypted or decrypted with the key stored > in a cookie. That cookie was fetched with the help of cgi in the module. > It worked great. But not now, as Rack is taking the place of cgi.I would just add the functionality to ActiveRecord: Build a module that does the AES stuff: module MyAes def self.append_features( base ) base.before_save do |model| model.encrypted_stuff = encrypt( model.plain_old_data ) if model.respond_to?( :plain_old_data ) end end def self.append_features( base ) base.after_find do |model| model.plain_old_data = decrypt( model.encrypted_stuff ) if model.respond_to?( :plain_old_data ) end end end Mix the module into ActiveRecord, in environment.rb: class ActiveRecord::Base include MyAes end class Foo < ActiveRecord::Base attr_accessor :plain_old_data end -- 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Jul 26, 11:27 pm, Pål Bergström <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Greg Donald wrote: > > 2010/7/26 P l Bergstr m <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>: > > 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] ) > > That I know. I was hoping to do something similar to what I had before, > when I could use cgi. Something easy using before_save and after_find. >With CGI the interface between the webserver and rails is essentially a whole bunch of environment variables, which can of course be read anywhere. That''s why you can create an instance of CGI and it gets all the request parameters out of thin air. Rack isn''t like that so it just isn''t possible to devine the current request object out of thin air. You could I suppose have a before filter in your requests that would stash the current request object (or its cookies) in thread local storage. Both this and your existing solution break encapsulation as others have said. For example it would be a real mess if you ever wanted to call any of these cookie using methods from a standalone mess because you''d have mess around create fake cookies. Fred -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Greg Donald wrote:> I would just add the functionality to ActiveRecord:Where does the unique aes key comes in, the user cookie? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
2010/7/26 Pål Bergström <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>:> What I want to achieve is to aes encrypt selected columns in the > database using a key stored in the users browser as a cookie.Are you doing this over https, or just plain http? -Dave -- Specialization is for insects. -RAH | Have Pun, Will Babble! -me Programming Blog: http://codosaur.us | Work: http://davearonson.com Leadership Blog: http://dare2xl.com | Play: http://davearonson.net -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Dave Aronson wrote:> Are you doing this over https, or just plain http?For now just over http. But eventually with ssl. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Dave Aronson
2010-Jul-27 15:56 UTC
Re: Re: Re: Re: Re: Re: Problem with reading cgi cookie
2010/7/27 Pål Bergström <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>:> Dave Aronson wrote: > >> Are you doing this over https, or just plain http? > > For now just over http. But eventually with ssl.Before this goes live? -Dave -- Specialization is for insects. -RAH | Have Pun, Will Babble! -me Programming Blog: http://codosaur.us | Work: http://davearonson.com Leadership Blog: http://dare2xl.com | Play: http://davearonson.net -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Pål Bergström
2010-Jul-27 16:06 UTC
Re: Re: Re: Re: Re: Re: Problem with reading cgi cookie
Dave Aronson wrote:>> For now just over http. But eventually with ssl. > > Before this goes live? > >Yes. It doesn''t matter. The key in the cookie has nothing to do with the overall security. It''s just an extra layer of security for the user, encrypted with aes. E.g. I don''t want to see certain info in the database when I look at it from the backend. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Pål Bergström wrote:> Greg Donald wrote: > >> I would just add the functionality to ActiveRecord: > > Where does the unique aes key comes in, the user cookie?It''s a unique user key for use with fast_aes in order to encrypt certain data in the database. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.