Sha256: aaaab4ba381d49fabb2e299ca62578b602112bd1f81a5caaa61d5cb10656c465
Contents?: true
Size: 675 Bytes
Versions: 1
Compression:
Stored size: 675 Bytes
Contents
module Devise module Models module DateRestrictable extend ActiveSupport::Concern def date_restricted? now = Date.today !((valid_from.nil? or now >= valid_from) and (valid_until.nil? or now <= valid_until)) end def self.required_fields(klass) attributes = [] attributes << :valid_from attributes << :valid_until attributes end def access_locked? date_restricted? end def active_for_authentication? super && !date_restricted? end def inactive_message date_restricted? ? :account_date_restricted : super end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
devise_date_restrictable-0.0.2 | lib/devise_date_restrictable/active_record.rb |