module RediSearch::Model::ClassMethods
Attributes
redi_search_index[R]
redi_search_serializer[R]
Public Instance Methods
redi_search(schema:, **options)
click to toggle source
rubocop:disable Metrics/MethodLength
# File lib/redi_search/model.rb, line 15 def redi_search(schema:, **options) @redi_search_index = Index.new( [options[:index_prefix], model_name.plural, RediSearch.env].compact.join("_"), schema, self ) @redi_search_serializer = options[:serializer] register_redi_search_commit_hooks scope :search_import, -> { all } include InstanceMethods extend ModelClassMethods end
Private Instance Methods
register_redi_search_commit_hooks()
click to toggle source
rubocop:enable Metrics/MethodLength
# File lib/redi_search/model.rb, line 34 def register_redi_search_commit_hooks after_commit(:redi_search_add_document, on: %i(create update)) if respond_to?(:after_commit) after_destroy_commit(:redi_search_delete_document) if respond_to?(:after_destroy_commit) end