No commit activity in last 3 years
No release in over 3 years
touch parents recursively in Mongoid
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

mongoid_touch_parents_recursively

touch parents recursively in Mongoid

Install

gem 'mongoid_touch_parents_recursively'

Usage

# 配置最公用的Mongoid::Sunshine
module Mongoid
  module Sunshine
    extend ActiveSupport::Concern
    included do
      include Mongoid::Document
      include Mongoid::Timestamps
      include Mongoid::TouchParentsRecursively
    end
  end
end

# 配置需要touch的父级
::Mongoid::TouchParentsRecursively.allowed_models_proc = lambda do |model_name|
  [Subject, Folder, FolderClassroom, FolderPiece, Piece].map(&:to_s).include? model_name
end