X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/7b89dc63496de0b6131a93c57d283ebb4490804b..7f05783949ce561d58904da133efd37438ebffe8:/app/models/access_token.rb diff --git a/app/models/access_token.rb b/app/models/access_token.rb index a1888343a..f690c9754 100644 --- a/app/models/access_token.rb +++ b/app/models/access_token.rb @@ -2,14 +2,14 @@ class AccessToken < OauthToken belongs_to :user belongs_to :client_application - scope :valid, where(:invalidated_at => nil) + scope :valid, -> { where(:invalidated_at => nil) } - validates_presence_of :user, :secret + validates :user, :secret, :presence => true before_create :set_authorized_at - -protected - + + protected + def set_authorized_at self.authorized_at = Time.now end