X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/64fb530581ffd21e2522e70e8a2d4c46d666f760..1f4d334dfe9d189227f1b1102304b5f20e9187c9:/app/models/access_token.rb diff --git a/app/models/access_token.rb b/app/models/access_token.rb index b773310ce..e5ba2e240 100644 --- a/app/models/access_token.rb +++ b/app/models/access_token.rb @@ -1,10 +1,53 @@ -class AccessToken client_applications.id) +# oauth_tokens_user_id_fkey (user_id => users.id) +# + +class AccessToken < OauthToken + belongs_to :user + belongs_to :client_application + + scope :valid, -> { where(:invalidated_at => nil) } + + validates :user, :secret, :presence => true + before_create :set_authorized_at - -protected - + + protected + def set_authorized_at self.authorized_at = Time.now end -end \ No newline at end of file +end