Use #data_source_exists? instead of #table_exists?

DEPRECATION WARNING: #table_exists? currently checks both tables and
views. This behavior is deprecated and will be changed with Rails 5.1
to only check tables. Use #data_source_exists? instead.
This commit is contained in:
Julian Herrero
2019-03-23 12:49:59 +01:00
parent b7a9995b38
commit f668317cc1
2 changed files with 2 additions and 2 deletions

View File

@@ -12,7 +12,7 @@ Devise.setup do |config|
# Configure the e-mail address which will be shown in Devise::Mailer,
# note that it will be overwritten if you use your own mailer class
# with default "from" parameter.
if Rails.env.test? || !ActiveRecord::Base.connection.table_exists?("settings")
if Rails.env.test? || !ActiveRecord::Base.connection.data_source_exists?("settings")
config.mailer_sender = "noreply@consul.dev"
else
config.mailer_sender = "'#{Setting["mailer_from_name"]}' <#{Setting["mailer_from_address"]}>"

View File

@@ -1,6 +1,6 @@
class CreateVerifiedUsers < ActiveRecord::Migration
def change
unless ActiveRecord::Base.connection.table_exists? 'verified_users'
unless ActiveRecord::Base.connection.data_source_exists?("verified_users")
create_table :verified_users do |t|
t.string :document_number
t.string :document_type