Hi! I''m just writing an application that stores some data withy ActiveRecord in a database. In this context I''d love to have every state of an object stored. Could it be possible to add some kind of version-control to ActiveRecord? I don''t have much experience with ruby, but this should be rather (?) simple. One could add an `version`-attribute and an ''internal_id''. Every find-method should then return the latest version of an object. Furthermore, a ''deleted''-column needs to be added. Has anyone thought of this before? Ist this implemented somewehere? Or is the idea plain stupid? Keep on rollin'' Peter
On 13.9.2005, at 12.25, Peter Horn wrote:> Hi! > > I''m just writing an application that stores some data withy > ActiveRecord in a database. In this context I''d love to have every > state of an object stored. Could it be possible to add some kind of > version-control to ActiveRecord? > > I don''t have much experience with ruby, but this should be rather > (?) simple. One could add an `version`-attribute and an > ''internal_id''. Every find-method should then return the latest > version of an object. > > Furthermore, a ''deleted''-column needs to be added. > > Has anyone thought of this before? Ist this implemented somewehere? > Or is the idea plain stupid?Hi Peter, One approach is to create a history table for old versions. Then you create an after_save callback that will add a new entry to the history table after the object is saved. That way your primary table won''t get cluttered with the version data. As a matter of fact, there''s something along these lines already in the works [1], to provide a generalized framework for versioning. //jarkko [1] http://wiki.rubyonrails.com/rails/show/ActsAsVersioned> > Keep on rollin'' > Peter > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Hi Take a look at http://wiki.rubyonrails.com/rails/show/ActsAsVersioned That should do what you want. Regards, Elliot On 13/09/05, Peter Horn <hornp-2nza8RwQl63YtjvyW6yDsg@public.gmane.org> wrote:> Hi! > > I''m just writing an application that stores some data withy > ActiveRecord in a database. In this context I''d love to have every > state of an object stored. Could it be possible to add some kind of > version-control to ActiveRecord? > > I don''t have much experience with ruby, but this should be rather (?) > simple. One could add an `version`-attribute and an ''internal_id''. > Every find-method should then return the latest version of an object. > > Furthermore, a ''deleted''-column needs to be added. > > Has anyone thought of this before? Ist this implemented somewehere? > Or is the idea plain stupid? > > Keep on rollin'' > Peter > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
On 9/13/05, Elliot Bowes <eblists-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi > > Take a look at http://wiki.rubyonrails.com/rails/show/ActsAsVersioned > > That should do what you want. > > Regards, > > ElliotThe latest is in my patch at http://dev.rubyonrails.com/ticket/1974. Though, this requires you to run on edge rails. -- rick http://techno-weenie.net