<commit_before>= has_many_versions

This attempts to provide versioning for 'has many' relationships within ActiveRecord.

Here is a pretty typical relationship.

   class Book < ActiveRecord::Base
     belongs_to :author
     validates_associated :author
   end
 
   class Author < ActiveRecord::Base
     has_many :books
   end

Lets say we want to include versioning now to modifications made to the collection of books. We can modify the +has_many+ relationship the following way:

   has_many :books, :extend => HasManyVersions
     
Now changes made to the relationship with the normal <tt><<</tt> and +delete+ methods will be tracked. There are some modifications needed for both tables for this to work. The owner of the relationship (in this case +Author+) needs an integer column named +version+ (with a default value of one). The collection (in this case +Book+) needs two columns, +initial_version+ and +version+. 

Assuming we've done all that, lets try out some magical versioning to see how it all works.<commit_msg>added rails install<commit_after>= has_many_versions

This attempts to provide versioning for 'has many' relationships within ActiveRecord.

== Installation

   script/plugin install git://github.com/joshbuddy/has_many_versions.git

== Usage

Here is a pretty typical relationship.

   class Book < ActiveRecord::Base
     belongs_to :author
     validates_associated :author
   end
 
   class Author < ActiveRecord::Base
     has_many :books
   end

Lets say we want to include versioning now to modifications made to the collection of books. We can modify the +has_many+ relationship the following way:

   has_many :books, :extend => HasManyVersions
     
Now changes made to the relationship with the normal <tt><<</tt> and +delete+ methods will be tracked. There are some modifications needed for both tables for this to work. The owner of the relationship (in this case +Author+) needs an integer column named +version+ (with a default value of one). The collection (in this case +Book+) needs two columns, +initial_version+ and +version+. 

Assuming we've done all that, lets try out some magical versioning to see how it all works.
{'fraction_non_alphanumeric': 0.059907834101382486, 'fraction_numerical': 0.0, 'mean_word_length': 4.231325301204819, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3889917', 'n_tokens_mistral': 562, 'n_tokens_neox': 536, 'n_words': 286}