Skip to content

Commit

Permalink
fixed an error in the AR consumer token code.
Browse files Browse the repository at this point in the history
  • Loading branch information
pelle committed Jan 4, 2011
1 parent dd93e75 commit d084b1c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions generators/oauth_consumer/templates/consumer_token.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,10 @@
class ConsumerToken < ActiveRecord::Base
include Oauth::Models::Consumers::Token

# You can safely remove this callback if you don't allow login from any of your services
before_create :create_user

# Modify this with class_name etc to match your application
belongs_to :user

end
2 changes: 1 addition & 1 deletion lib/oauth/models/consumers/token.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def find_or_create_from_access_token(user,access_token)
user.consumer_tokens.first(:conditions=>{:type=>self.to_s,:token=>access_token.token}) ||
user.consumer_tokens.create!(:type=>self.to_s,:token=>access_token.token, :secret=>access_token.secret)
else
ConsumerToken.first( :token=>access_token.token,:type=>self.to_s) ||
ConsumerToken.first( :conditions =>{ :token=>access_token.token,:type=>self.to_s}) ||
create(:type=>self.to_s,:token=>access_token.token, :secret=>access_token.secret)
end
end
Expand Down

0 comments on commit d084b1c

Please sign in to comment.