ximate 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ximate/search.rb +12 -10
- data/lib/ximate/version.rb +1 -1
- metadata +2 -2
data/lib/ximate/search.rb
CHANGED
@@ -13,20 +13,22 @@ module Ximate
|
|
13
13
|
|
14
14
|
module Search
|
15
15
|
def define_index(locale = I18n.default_locale, &block)
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
if ActiveRecord::Base.connection.tables.include?(self.to_s.underscore.pluralize)
|
17
|
+
table = self.to_s.underscore.pluralize.to_sym
|
18
|
+
DATA[locale.to_sym] ||= {}
|
19
|
+
DATA[locale.to_sym][table] ||= {}
|
19
20
|
|
20
|
-
|
21
|
-
|
21
|
+
extend ClassMethods
|
22
|
+
include InstanceMethods
|
22
23
|
|
23
|
-
|
24
|
+
after_save { |proc| proc.update_index(I18n.locale, &block) }
|
24
25
|
|
25
|
-
|
26
|
-
|
27
|
-
|
26
|
+
now = Time.now
|
27
|
+
self.to_s.classify.constantize.all.each do |p|
|
28
|
+
p.update_index(locale, &block)
|
29
|
+
end
|
30
|
+
puts "\b\b=> Build XIMATE hash data for '#{table}' in #{Time.now - now}s." if OPTIONS[:logger]
|
28
31
|
end
|
29
|
-
puts "\b\b=> Build XIMATE hash data for '#{table}' in #{Time.now - now}s." if OPTIONS[:logger]
|
30
32
|
end
|
31
33
|
end
|
32
34
|
|
data/lib/ximate/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: ximate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.2.
|
5
|
+
version: 0.2.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Enrico Pilotto
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-06-
|
13
|
+
date: 2011-06-15 00:00:00 +02:00
|
14
14
|
default_executable:
|
15
15
|
dependencies: []
|
16
16
|
|