binarylogic-searchlogic 2.1.2 → 2.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,7 @@
1
+ == 2.1.3
2
+
3
+ * Added a no conflic resolution for other libraries already using the "search" method. If you have a conflict, use "searchlogic".
4
+
1
5
  == 2.1.2 released 2009-07-04
2
6
 
3
7
  * Undefine the id method for the Search class, so that it acts like a condition.
data/README.rdoc CHANGED
@@ -199,6 +199,16 @@ Instead of recreating the wheel with pagination, Searchlogic works great with wi
199
199
 
200
200
  If you don't like will_paginate, use another solution, or roll your own. Pagination really has nothing to do with searching, and the main goal for Searchlogic v2 was to keep it lean and simple. No reason to recreate the wheel and bloat the library.
201
201
 
202
+ == Conflicts with other gems
203
+
204
+ You will notice searchlogic wants to create a method called "search". So do other libraries like thinking sphinx, etc. So searchlogic has a no conflict resolution. If the "search" method is already taken the method will be called "searchlogic" instead. So instead of
205
+
206
+ User.search
207
+
208
+ You would do:
209
+
210
+ User.searchlogic
211
+
202
212
  == Under the hood
203
213
 
204
214
  Before I use a library in my application I like to glance at the source and try to at least understand the basics of how it works. If you are like me, a nice little explanation from the author is always helpful:
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 2
3
3
  :minor: 1
4
- :patch: 2
4
+ :patch: 3
@@ -17,8 +17,11 @@ module Searchlogic
17
17
  class Search
18
18
  # Responsible for adding a "search" method into your models.
19
19
  module Implementation
20
- # Returns a new Search object for the given model.
21
- def search(conditions = {})
20
+ # Additional method, gets aliases as "search" if that method
21
+ # is available. A lot of other libraries like to use "search"
22
+ # as well, so if you have a conflict like this, you can use
23
+ # this method directly.
24
+ def searchlogic(conditions = {})
22
25
  Search.new(self, scope(:find), conditions)
23
26
  end
24
27
  end
data/lib/searchlogic.rb CHANGED
@@ -14,6 +14,16 @@ ActiveRecord::Base.extend(Searchlogic::NamedScopes::Associations)
14
14
  ActiveRecord::Base.extend(Searchlogic::NamedScopes::AliasScope)
15
15
  ActiveRecord::Base.extend(Searchlogic::Search::Implementation)
16
16
 
17
+ # Try to use the search method, if it's available. Thinking sphinx and other plugins
18
+ # like to use that method as well.
19
+ if !ActiveRecord::Base.respond_to?(:search)
20
+ ActiveRecord::Base.class_eval do
21
+ class << self
22
+ alias_method :search, :searchlogic
23
+ end
24
+ end
25
+ end
26
+
17
27
  if defined?(ActionController)
18
28
  require "searchlogic/rails_helpers"
19
29
  ActionController::Base.helper(Searchlogic::RailsHelpers)
data/searchlogic.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{searchlogic}
5
- s.version = "2.1.2"
5
+ s.version = "2.1.3"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Ben Johnson of Binary Logic"]
9
- s.date = %q{2009-07-04}
9
+ s.date = %q{2009-07-10}
10
10
  s.email = %q{bjohnson@binarylogic.com}
11
11
  s.extra_rdoc_files = [
12
12
  "LICENSE",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: binarylogic-searchlogic
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Johnson of Binary Logic
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-07-04 00:00:00 -07:00
12
+ date: 2009-07-10 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency