elastic_record 0.6.2 → 0.6.3

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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'elastic_record'
5
- s.version = '0.6.2'
5
+ s.version = '0.6.3'
6
6
  s.summary = 'Use Elastic Search with your objects'
7
7
  s.description = 'Find your records with elastic search'
8
8
 
@@ -16,6 +16,14 @@ module ElasticRecord
16
16
  def connection_options=(options)
17
17
  @connection_options = options
18
18
  end
19
+
20
+ def model_names=(names)
21
+ @model_names = names
22
+ end
23
+
24
+ def models
25
+ @models ||= @model_names.map { |model_name| model_name.constantize }
26
+ end
19
27
  end
20
28
  end
21
29
  end
@@ -4,7 +4,7 @@ module ElasticRecord
4
4
  if class_name = ENV['CLASS']
5
5
  [class_name.camelize.constantize]
6
6
  else
7
- IndexedModels.all
7
+ ElasticRecord::Config.models
8
8
  end
9
9
  end
10
10
  end
@@ -10,6 +10,12 @@ module ElasticRecord
10
10
  autoload :Model, 'elastic_record/model'
11
11
  autoload :Relation, 'elastic_record/relation'
12
12
  autoload :Searching, 'elastic_record/searching'
13
+
14
+ class << self
15
+ def configure
16
+ yield(ElasticRecord::Config)
17
+ end
18
+ end
13
19
  end
14
20
 
15
21
  require 'elastic_record/railtie' if defined?(Rails)
@@ -1,4 +1,9 @@
1
1
  require 'helper'
2
2
 
3
3
  class ElasticRecord::ConfigTest < MiniTest::Spec
4
+ def test_models
5
+ ElasticRecord::Config.model_names = %w(Widget)
6
+
7
+ assert_equal [Widget], ElasticRecord::Config.models
8
+ end
4
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elastic_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-13 00:00:00.000000000 Z
12
+ date: 2012-09-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: arelastic