touch parents recursively in Mongoid
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is even with SunshineLibrary:sunshine.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
.gitignore
LICENSE
README.markdown
mongoid_touch_parents_recursively.gemspec

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