10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/devise/oauth2_providable/expirable_token.rb', line 10
def expires_according_to(config_name)
cattr_accessor :default_lifetime
self.default_lifetime = Rails.application.config.devise_oauth2_providable[config_name]
belongs_to :user
belongs_to :client
after_initialize :init_token, :on => :create, :unless => :token?
after_initialize :init_expires_at, :on => :create, :unless => :expires_at?
validates :expires_at, :presence => true
validates :client, :presence => true
validates :token, :presence => true, :uniqueness => true
default_scope lambda {
where(self.arel_table[:expires_at].gteq(Time.now.utc))
}
include LocalInstanceMethods
end
|