ximate 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,20 +13,22 @@ module Ximate
13
13
 
14
14
  module Search
15
15
  def define_index(locale = I18n.default_locale, &block)
16
- table = self.to_s.underscore.pluralize.to_sym
17
- DATA[locale.to_sym] ||= {}
18
- DATA[locale.to_sym][table] ||= {}
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
- extend ClassMethods
21
- include InstanceMethods
21
+ extend ClassMethods
22
+ include InstanceMethods
22
23
 
23
- after_save { |proc| proc.update_index(I18n.locale, &block) }
24
+ after_save { |proc| proc.update_index(I18n.locale, &block) }
24
25
 
25
- now = Time.now
26
- self.to_s.classify.constantize.all.each do |p|
27
- p.update_index(locale, &block)
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
 
@@ -1,3 +1,3 @@
1
1
  module Ximate
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: ximate
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.1
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-08 00:00:00 +02:00
13
+ date: 2011-06-15 00:00:00 +02:00
14
14
  default_executable:
15
15
  dependencies: []
16
16