]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/access_token.rb
Fix some rubocop rails style issues
[rails.git] / app / models / access_token.rb
index b773310ceb59374bb95647f5989492869fcea6ef..f690c97542472dfa4fdbc54b5826e5dea4cf2d37 100644 (file)
@@ -1,10 +1,16 @@
-class AccessToken<OauthToken
-  validates_presence_of :user
+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