Hey guys, I made a gem for tracking changes on specific fields in ActiveRecord models. Its very easy to get started using, and automatically creates models and associations to history objects which contain the changes made. If you have a table like: users: (id, email, created_at) And you''d like to track all of the changes the email has been through over time, in your model you''d just write: class User < ActiveRecord::Base track_history end and create a table in a migration like: user_histories: (id, user_id, email_before, email_after, created_at) Automatically when you start up your server, user instances will have #histories (an array of UserHistory objects) and UserHistory will have some convenience methods which you can read more about in the README. You can also add annotations like: class User < ActiveRecord::Base track_history do annotate(:day_of_week) { Time.zone.now.wday } end end And the value of the annotation will be saved whenever the object is updated. There''s are a bunch of other options to check out and configure, such as the ability to track creates and deletes cleanly. Check it out! https://github.com/seejohnrun/track_history John Crepezzi @seejohnrun -- 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.
Walter Lee Davis
2011-Jan-12 16:33 UTC
Re: [ANN] TrackHistory: An easy way to track changes
On Jan 12, 2011, at 9:40 AM, John Crepezzi wrote:> Hey guys, > > I made a gem for tracking changes on specific fields in ActiveRecord > models. > Its very easy to get started using, and automatically creates models > and > associations to history objects which contain the changes made.This looks very promising! Is there any magic in it to roll back to a previous state? Or is that out of scope for what it''s meant to do? Walter -- 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.
acts_as_audited or acts_as_versioned, things like that. -- 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.
Not yet, but I think its definitely in the scope and should be coming soon On Jan 12, 11:33 am, Walter Lee Davis <wa...-HQgmohHLjDZWk0Htik3J/w@public.gmane.org> wrote:> On Jan 12, 2011, at 9:40 AM, John Crepezzi wrote: > > > Hey guys, > > > I made a gem for tracking changes on specific fields in ActiveRecord > > models. > > Its very easy to get started using, and automatically creates models > > and > > associations to history objects which contain the changes made. > > This looks very promising! Is there any magic in it to roll back to a > previous state? Or is that out of scope for what it''s meant to do? > > Walter-- 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.