Hi All, I added a column to the sessions table called "created_at" in order to allow the created time to be recorded. However, different from other Models, the column does not update automatically. Therefore, what codes should I add to update the sessions."created_at" value? It is important for avoiding hacker keeping the sessions alive. Thanks much! Arthur -- 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 -~----------~----~----~----~------~----~------~--~---
On Feb 11, 9:31 am, Arthur Chan <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hi All, > > I added a column to the sessions table called "created_at" in order to > allow the created time to be recorded. > > However, different from other Models, the column does not update > automatically. >What flavour of active record store do you use ? Some people use ones which mostly bypass activerecord (and as a result you don''t get some of the stuff AR gives you for free), Fred> Therefore, what codes should I add to update the sessions."created_at" > value? > > It is important for avoiding hacker keeping the sessions alive. > > Thanks much! > Arthur > -- > 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-/JYPxA39Uh5TLH3MbocFFw@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 -~----------~----~----~----~------~----~------~--~---
Hi Fred, Do you mean? config.action_controller.session_store = :active_record_store I am setting up as the above. Does it mean that I should have the function? Thanks Arthur Frederick Cheung wrote:> On Feb 11, 9:31�am, Arthur Chan <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > wrote: >> Hi All, >> >> I added a column to the sessions table called "created_at" in order to >> allow the created time to be recorded. >> >> However, different from other Models, the column does not update >> automatically. >> > What flavour of active record store do you use ? Some people use ones > which mostly bypass activerecord (and as a result you don''t get some > of the stuff AR gives you for free), > > Fred-- 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Created_at is supposed to be filled only at creation time, right? Shouldn''t you use updated_at instead? On Wed, Feb 11, 2009 at 7:31 AM, Arthur Chan < rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Hi All, > > I added a column to the sessions table called "created_at" in order to > allow the created time to be recorded. > > However, different from other Models, the column does not update > automatically. > > Therefore, what codes should I add to update the sessions."created_at" > value? > > It is important for avoiding hacker keeping the sessions alive. > > Thanks much! > Arthur > -- > 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 -~----------~----~----~----~------~----~------~--~---
Yes. The problem is that the field has not been filled at any time... I just want both "created_at" and "updated_at" be filled in automatically. Mathieu Rousseau wrote:> Created_at is supposed to be filled only at creation time, right? > Shouldn''t > you use updated_at instead? > > On Wed, Feb 11, 2009 at 7:31 AM, Arthur Chan <-- 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 -~----------~----~----~----~------~----~------~--~---
With default AR it always did this for me automatically... Frederick said something about using a different flavour of AR, but that''s beyond my knowledge... On Wed, Feb 11, 2009 at 8:17 AM, Arthur Chan < rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Yes. > > The problem is that the field has not been filled at any time... > > I just want both "created_at" and "updated_at" be filled in > automatically. > > > Mathieu Rousseau wrote: > > Created_at is supposed to be filled only at creation time, right? > > Shouldn''t > > you use updated_at instead? > > > > On Wed, Feb 11, 2009 at 7:31 AM, Arthur Chan < > > -- > 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 -~----------~----~----~----~------~----~------~--~---
On 11 Feb 2009, at 10:21, Mathieu Rousseau wrote:> With default AR it always did this for me automatically... Frederick > said something about using a different flavour of AR, but that''s > beyond my knowledge... >To expand on what I said, when you use active_record_store you provide a session class that handles the loading and saving of the data (as opposed to the other bits of a session store). Rails provides an implementation which is just a plain old model class but you can replace that with one that just issues raw sql statements (mostly in the interest of speed). An example one is included with rails. Obviously if you didn''t know any of that you probably haven;''t done that :-) In the absence of all that created_at and updated_at should update automatically as it is just a regular ActiveRecord class. Dumb question: did you restart your mongrel or whatever is handling your requests after you added that column ? Fred> On Wed, Feb 11, 2009 at 8:17 AM, Arthur Chan <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org > > wrote: > > Yes. > > The problem is that the field has not been filled at any time... > > I just want both "created_at" and "updated_at" be filled in > automatically. > > > Mathieu Rousseau wrote: > > Created_at is supposed to be filled only at creation time, right? > > Shouldn''t > > you use updated_at instead? > > > > On Wed, Feb 11, 2009 at 7:31 AM, Arthur Chan < > > -- > 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 -~----------~----~----~----~------~----~------~--~---