<commit_before>= Touches

This project rocks and uses MIT-LICENSE.<commit_msg>wrote readme<commit_after>= Touches

has_many through relations do not update timestamps. Touches is to be used to update cached content in some m:n parent:child relationship.

In the example above a category would not update if a contained product updates e.g. its name.

touches enables bidirectional update of timestamps.

For new entries to touch the parent, you have to insert touch: true into the join-model!!




= Example

class Category < ActiveRecord::Base
  has_many :products_categories
  has_many :products, through: :products_categories

  touches :products
end

class Product < ActiveRecord::Base
  has_many :products_categories
  has_many :categories, through: :products_categories

  touches :categories
end

class ProductsCategory < ActiveRecord::Base
  belongs_to :product, touch: true
  belongs_to :category, touch: true
end



{'fraction_non_alphanumeric': 0.055135135135135134, 'fraction_numerical': 0.0, 'mean_word_length': 5.052287581699346, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 3, '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': '6381117', 'n_tokens_mistral': 256, 'n_tokens_neox': 249, 'n_words': 107}