Skip to content
Branch: sunshine
Go to file
Code
This branch is even with SunshineLibrary:sunshine.

Latest commit

Files

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

README.markdown

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

Releases

No releases published
You can’t perform that action at this time.