0

I check there is no model for oauth_access_tokens in rails app but I can use sql to check the tokens. How can I use SQL to check for existence of tokens for specific user. My current solution which is not working is as follow:

query = "SELECT user_id FROM table_name"
found = false
ActiveRecord::Base.connection.select_all(query) do |r|
  if r.user_id == "my_user_id"
    found = true
    break
  end
end
assert found
Akadisoft
  • 306
  • 1
  • 2
  • 13

1 Answers1

0

I figured it out:

ActiveRecord::Base.connection.select_all(query).each do |r|
Akadisoft
  • 306
  • 1
  • 2
  • 13