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