Class: ActiveRecord::Base
- Inherits:
-
Object
- Object
- ActiveRecord::Base
show all
- Defined in:
- lib/indexed_search/disabler.rb
Overview
add some stuff to all activerecord models to check if something should be indexed or not
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.no_indexing? ⇒ Boolean
17
18
19
|
# File 'lib/indexed_search/disabler.rb', line 17
def self.no_indexing?
(@@no_indexing ||= false)
end
|
.without_indexing ⇒ Object
9
10
11
12
13
|
# File 'lib/indexed_search/disabler.rb', line 9
def self.without_indexing
prev_indexing = (@@no_indexing ||= false)
@@no_indexing = true
yield.tap { @@no_indexing = prev_indexing }
end
|
Instance Method Details
#no_indexing? ⇒ Boolean
14
15
16
|
# File 'lib/indexed_search/disabler.rb', line 14
def no_indexing?
(@@no_indexing ||= false) || @no_indexing
end
|
#without_indexing ⇒ Object
4
5
6
7
8
|
# File 'lib/indexed_search/disabler.rb', line 4
def without_indexing
prev_indexing = @no_indexing
@no_indexing = true
yield.tap { @no_indexing = prev_indexing }
end
|