Delete tokens for an application when the application is deleted
authorTom Hughes <tom@compton.nu>
Mon, 23 Apr 2012 20:30:41 +0000 (21:30 +0100)
committerTom Hughes <tom@compton.nu>
Mon, 23 Apr 2012 20:30:41 +0000 (21:30 +0100)
app/models/client_application.rb

index b1f4022..9a074fb 100644 (file)
@@ -2,7 +2,7 @@ require 'oauth'
 
 class ClientApplication < ActiveRecord::Base
   belongs_to :user
-  has_many :tokens, :class_name => "OauthToken"
+  has_many :tokens, :class_name => "OauthToken", :dependent => :delete_all
   has_many :access_tokens
   has_many :oauth2_verifiers
   has_many :oauth_tokens