#
class AccessToken < OauthToken
- belongs_to :user
- belongs_to :client_application
+ belongs_to :user, :optional => true
+ belongs_to :client_application, :optional => true
scope :valid, -> { where(:invalidated_at => nil) }
before_create :set_authorized_at
+ def includes_scope?(scope)
+ self[:"allow_#{scope}"]
+ end
+
protected
def set_authorized_at
- self.authorized_at = Time.now
+ self.authorized_at = Time.now.utc
end
end