Skip to content

Commit

Permalink
Set table_name before including Mixin
Browse files Browse the repository at this point in the history
Included uses respond_to? which queries the incorrect table name
  • Loading branch information
levent committed Aug 18, 2015
1 parent 4bb957d commit 5d9b2d5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/doorkeeper/orm/active_record/access_grant.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Doorkeeper
class AccessGrant < ActiveRecord::Base
include AccessGrantMixin

self.table_name = "#{table_name_prefix}oauth_access_grants#{table_name_suffix}".to_sym

include AccessGrantMixin
end
end
4 changes: 2 additions & 2 deletions lib/doorkeeper/orm/active_record/access_token.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module Doorkeeper
class AccessToken < ActiveRecord::Base
include AccessTokenMixin

self.table_name = "#{table_name_prefix}oauth_access_tokens#{table_name_suffix}".to_sym

include AccessTokenMixin

def self.delete_all_for(application_id, resource_owner)
where(application_id: application_id,
resource_owner_id: resource_owner.id).delete_all
Expand Down
4 changes: 2 additions & 2 deletions lib/doorkeeper/orm/active_record/application.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module Doorkeeper
class Application < ActiveRecord::Base
include ApplicationMixin

self.table_name = "#{table_name_prefix}oauth_applications#{table_name_suffix}".to_sym

include ApplicationMixin

if ActiveRecord::VERSION::MAJOR >= 4
has_many :authorized_tokens, -> { where(revoked_at: nil) }, class_name: 'AccessToken'
else
Expand Down

0 comments on commit 5d9b2d5

Please sign in to comment.