Sha256: 5a37779cd97370ef552cc1ddbcf44e4f6e452cdd75e25b0f861e2851717bea8f

Contents?: true

Size: 846 Bytes

Versions: 38

Compression:

Stored size: 846 Bytes

Contents

module Locomotive
  module Concerns
    module Shared
      module SiteScope

        extend ActiveSupport::Concern

        included do

          ## associations ##
          belongs_to :site, class_name: 'Locomotive::Site', validate: false, autosave: false, touch: :true

          ## validations ##
          validates_presence_of :site

          ## indexes ##
          index site_id: 1

          # Redefine the auto-generated method by the Mongoid Touchable module
          # in order to touch another field of the site object.
          def touch_site_after_create_or_destroy
            without_autobuild do
              _site = __send__(:site)
              _site.touch(touch_site_attribute) if _site
            end
          end

        end

        def touch_site_attribute
          nil
        end

      end
    end
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
locomotivecms-3.3.0.rc1 app/models/locomotive/concerns/shared/site_scope.rb
locomotivecms-3.2.0 app/models/locomotive/concerns/shared/site_scope.rb
locomotivecms-3.2.0.rc2 app/models/locomotive/concerns/shared/site_scope.rb
locomotivecms-3.2.0.rc1 app/models/locomotive/concerns/shared/site_scope.rb
locomotivecms-3.1.1 app/models/locomotive/concerns/shared/site_scope.rb
locomotivecms-3.1.0 app/models/locomotive/concerns/shared/site_scope.rb
locomotivecms-3.1.0.rc3 app/models/locomotive/concerns/shared/site_scope.rb
locomotivecms-3.1.0.rc2 app/models/locomotive/concerns/shared/site_scope.rb
locomotivecms-3.1.0.rc1 app/models/locomotive/concerns/shared/site_scope.rb
locomotivecms-3.0.1 app/models/locomotive/concerns/shared/site_scope.rb
locomotivecms-3.0.0 app/models/locomotive/concerns/shared/site_scope.rb
locomotivecms-3.0.0.rc7 app/models/locomotive/concerns/shared/site_scope.rb
locomotivecms-3.0.0.rc6 app/models/locomotive/concerns/shared/site_scope.rb
locomotivecms-3.0.0.rc5 app/models/locomotive/concerns/shared/site_scope.rb
locomotivecms-3.0.0.rc4 app/models/locomotive/concerns/shared/site_scope.rb
locomotivecms-3.0.0.rc3 app/models/locomotive/concerns/shared/site_scope.rb
locomotivecms-3.0.0.rc2 app/models/locomotive/concerns/shared/site_scope.rb
locomotivecms-3.0.0.rc1 app/models/locomotive/concerns/shared/site_scope.rb