Module: Searchjoy
- Defined in:
- lib/searchjoy.rb,
lib/searchjoy/track.rb,
lib/searchjoy/engine.rb,
lib/searchjoy/version.rb,
app/models/searchjoy/search.rb,
app/models/searchjoy/conversion.rb,
lib/generators/searchjoy/install_generator.rb,
app/controllers/searchjoy/searches_controller.rb
Defined Under Namespace
Modules: Generators, Track
Classes: Conversion, Engine, Search, SearchesController
Constant Summary
collapse
- VERSION =
"1.3.2"
Class Method Summary
collapse
Class Method Details
.attach_to_searchkick! ⇒ Object
30
31
32
33
34
|
# File 'lib/searchjoy.rb', line 30
def self.attach_to_searchkick!
Searchkick::Query.prepend(Searchjoy::Track::Query)
Searchkick::MultiSearch.prepend(Searchjoy::Track::MultiSearch)
Searchkick::Results.send(:attr_accessor, :search)
end
|
.backfill_conversions ⇒ Object
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/searchjoy.rb', line 36
def self.backfill_conversions
Searchjoy::Search.where.not(converted_at: nil).left_joins(:conversions).where(searchjoy_conversions: {id: nil}).find_in_batches do |searches|
conversions =
searches.map do |search|
{
search_id: search.id,
convertable_id: search.convertable_id,
convertable_type: search.convertable_type,
created_at: search.converted_at
}
end
Searchjoy::Conversion.insert_all(conversions)
end
end
|
.time_zone=(time_zone) ⇒ Object
13
14
15
|
# File 'lib/searchjoy.rb', line 13
def self.time_zone=(time_zone)
@@time_zone = time_zone.is_a?(String) ? ActiveSupport::TimeZone.new(time_zone) : time_zone
end
|