Sha256: e2b73059d50006024c155c1503d37d441d4e0c7b5c5da1943fcd600fd3f50ce2

Contents?: true

Size: 523 Bytes

Versions: 15

Compression:

Stored size: 523 Bytes

Contents

module Wobauth
  class Authority < ActiveRecord::Base
    # -- associations
    belongs_to :authorizable,   polymorphic: true
    belongs_to :role
    belongs_to :authorized_for, polymorphic: true, optional: true

    # -- configuration
    # -- validations and callbacks
    validates :authorizable_id, :authorizable_type,
              :role_id, presence: true

    scope :valid, ->(date) { 
      where('(valid_until >= ? OR valid_until is NULL) AND (valid_from <= ? OR valid_from is NULL)', date, date)
    }
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
wobauth-6.0.1 app/models/wobauth/authority.rb
wobauth-6.0.0 app/models/wobauth/authority.rb
wobauth-5.1.3 app/models/wobauth/authority.rb
wobauth-5.1.2 app/models/wobauth/authority.rb
wobauth-5.1.1 app/models/wobauth/authority.rb
wobauth-5.1.0 app/models/wobauth/authority.rb
wobauth-5.0.2 app/models/wobauth/authority.rb
wobauth-5.0.1 app/models/wobauth/authority.rb
wobauth-5.0.0 app/models/wobauth/authority.rb
wobauth-4.0.0 app/models/wobauth/authority.rb
wobauth-3.4.8 app/models/wobauth/authority.rb
wobauth-3.4.7 app/models/wobauth/authority.rb
wobauth-3.4.6 app/models/wobauth/authority.rb
wobauth-3.4.5 app/models/wobauth/authority.rb
wobauth-3.4.4 app/models/wobauth/authority.rb