2016-11-15 10:56:29 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-08-17 11:56:23 -04:00
|
|
|
class ApplicationRecord < ActiveRecord::Base
|
|
|
|
self.abstract_class = true
|
2019-08-05 13:54:29 -04:00
|
|
|
|
2018-03-26 08:02:10 -04:00
|
|
|
include Remotable
|
2019-08-05 13:54:29 -04:00
|
|
|
|
2023-08-08 07:59:40 -04:00
|
|
|
connects_to database: { writing: :primary, reading: ENV['REPLICA_DB_NAME'] || ENV['REPLICA_DATABASE_URL'] ? :replica : :primary }
|
2023-07-17 02:26:52 -04:00
|
|
|
|
2019-09-30 19:19:11 -04:00
|
|
|
class << self
|
|
|
|
def update_index(_type_name, *_args, &_block)
|
|
|
|
super if Chewy.enabled?
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-08-05 13:54:29 -04:00
|
|
|
def boolean_with_default(key, default_value)
|
|
|
|
value = attributes[key]
|
|
|
|
|
|
|
|
if value.nil?
|
|
|
|
default_value
|
|
|
|
else
|
|
|
|
value
|
|
|
|
end
|
|
|
|
end
|
2016-08-17 11:56:23 -04:00
|
|
|
end
|