application_record.rb 492 B

12345678910111213141516171819202122232425
  1. # frozen_string_literal: true
  2. class ApplicationRecord < ActiveRecord::Base
  3. self.abstract_class = true
  4. include Remotable
  5. connects_to database: { writing: :primary, reading: :replica } if DatabaseHelper.replica_enabled?
  6. class << self
  7. def update_index(_type_name, *_args, &_block)
  8. super if Chewy.enabled?
  9. end
  10. end
  11. def boolean_with_default(key, default_value)
  12. value = attributes[key]
  13. if value.nil?
  14. default_value
  15. else
  16. value
  17. end
  18. end
  19. end