Skip to content

SunshineLibrary/mongoid_touch_parents_recursively

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

touch parents recursively in Mongoid

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages