Skip to content

mvj3/mongoid_touch_parents_recursively

sunshine
Switch branches/tags
Code
This branch is up to date with SunshineLibrary/mongoid_touch_parents_recursively:sunshine.
Contribute

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
lib
 
 
 
 
 
 

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