Sha256: 6e2a64c39f6899add32d493a1ffd849e17467cd218ee400131e84d9d707f2a46

Contents?: true

Size: 509 Bytes

Versions: 6

Compression:

Stored size: 509 Bytes

Contents

# encoding: UTF-8

module Spontaneous::Model::Page
  module Locks
    extend Spontaneous::Concern

    included do
      one_to_many :update_locks, class: Spontaneous::PageLock, key: :page_id

      Spontaneous::PageLock.many_to_one :page,    class: model, key: :page_id
      Spontaneous::PageLock.many_to_one :content, class: model, key: :content_id
    end

    def locked_for_update?
      !update_locks.empty?
    end

    def after_destroy
      update_locks_dataset.delete
      super
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
spontaneous-0.2.0.beta10 lib/spontaneous/model/page/locks.rb
spontaneous-0.2.0.beta9 lib/spontaneous/model/page/locks.rb
spontaneous-0.2.0.beta8 lib/spontaneous/model/page/locks.rb
spontaneous-0.2.0.beta7 lib/spontaneous/model/page/locks.rb
spontaneous-0.2.0.beta6 lib/spontaneous/model/page/locks.rb
spontaneous-0.2.0.beta5 lib/spontaneous/model/page/locks.rb