metamaps--metamaps/config/initializers/access_codes.rb
2016-09-24 12:27:34 +08:00

7 lines
270 B
Ruby

# frozen_string_literal: true
$codes = []
if ActiveRecord::Base.connection.data_source_exists? 'users'
$codes = ActiveRecord::Base.connection
.execute('SELECT code FROM users')
.map { |user| user['code'] }
end