Commit 31491cc8480aa016111127d667f4ae56d2acd4f2
1 parent
faf02e35
Exists in
master
and in
28 other branches
Disable Solr for db:data:minimal task
Again, unlike acts_as_ferret, acts_as_solr doesn't work without the Solr server. So to avoid debian postinst script rake db:data:minimal to fail disable it.
Showing
2 changed files
with
13 additions
and
7 deletions
Show diff stats
Rakefile
lib/acts_as_searchable.rb
| 1 | 1 | module ActsAsSearchable |
| 2 | 2 | |
| 3 | 3 | module ClassMethods |
| 4 | + ACTS_AS_SEARCHABLE_ENABLED = true unless defined? ACTS_AS_SEARCHABLE_ENABLED | |
| 5 | + | |
| 4 | 6 | def acts_as_searchable(options = {}) |
| 5 | - if (!options[:fields]) | |
| 6 | - options[:additional_fields] |= [{:schema_name => :string}] | |
| 7 | - else | |
| 8 | - options[:fields] << {:schema_name => :string} | |
| 7 | + if ACTS_AS_SEARCHABLE_ENABLED | |
| 8 | + if (!options[:fields]) | |
| 9 | + options[:additional_fields] |= [{:schema_name => :string}] | |
| 10 | + else | |
| 11 | + options[:fields] << {:schema_name => :string} | |
| 12 | + end | |
| 13 | + acts_as_solr options | |
| 14 | + extend FindByContents | |
| 15 | + send :include, InstanceMethods | |
| 9 | 16 | end |
| 10 | - acts_as_solr options | |
| 11 | - extend FindByContents | |
| 12 | - send :include, InstanceMethods | |
| 13 | 17 | end |
| 14 | 18 | |
| 15 | 19 | module InstanceMethods | ... | ... |