binarylogic-searchlogic 2.1.3 → 2.1.4

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.
data/CHANGELOG.rdoc CHANGED
@@ -1,6 +1,8 @@
1
1
  == 2.1.3
2
2
 
3
3
  * Added a no conflic resolution for other libraries already using the "search" method. If you have a conflict, use "searchlogic".
4
+ * Put the hidden order field in a div, to be valid XHTML.
5
+ * Add ActiveRecordConsistency module to help AR remove duplicate joins easier.
4
6
 
5
7
  == 2.1.2 released 2009-07-04
6
8
 
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 2
3
3
  :minor: 1
4
- :patch: 3
4
+ :patch: 4
@@ -0,0 +1,27 @@
1
+ module Searchlogic
2
+ # Active Record is pretty inconsistent with how their SQL is constructed. This
3
+ # method attempts to close the gap between the various inconsistencies.
4
+ module ActiveRecordConsistency
5
+ def self.included(klass)
6
+ klass.class_eval do
7
+ alias_method_chain :merge_joins, :searchlogic
8
+ end
9
+ end
10
+
11
+ # In AR multiple joins are sometimes in a single join query, and other time they
12
+ # are not. The merge_joins method in AR should account for this, but it doesn't.
13
+ # This fixes that problem.
14
+ def merge_joins_with_searchlogic(*args)
15
+ joins = merge_joins_without_searchlogic(*args)
16
+ joins.collect { |j| j.split(" ") }.flatten.uniq
17
+ end
18
+ end
19
+ end
20
+
21
+ module ActiveRecord # :nodoc: all
22
+ class Base
23
+ class << self
24
+ include Searchlogic::ActiveRecordConsistency
25
+ end
26
+ end
27
+ end
@@ -59,7 +59,7 @@ module Searchlogic
59
59
  def fields_for(*args, &block)
60
60
  if search_obj = args.find { |arg| arg.is_a?(Searchlogic::Search) }
61
61
  args.unshift(:search) if args.first == search_obj
62
- concat(hidden_field_tag("#{args.first}[order]", search_obj.order) + "\n")
62
+ concat(content_tag("div", hidden_field_tag("#{args.first}[order]", search_obj.order)) + "\n")
63
63
  super
64
64
  else
65
65
  super
data/lib/searchlogic.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require "searchlogic/core_ext/proc"
2
2
  require "searchlogic/core_ext/object"
3
+ require "searchlogic/active_record_consistency"
3
4
  require "searchlogic/named_scopes/conditions"
4
5
  require "searchlogic/named_scopes/ordering"
5
6
  require "searchlogic/named_scopes/associations"
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.3"
5
+ s.version = "2.1.4"
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-10}
9
+ s.date = %q{2009-07-12}
10
10
  s.email = %q{bjohnson@binarylogic.com}
11
11
  s.extra_rdoc_files = [
12
12
  "LICENSE",
@@ -21,6 +21,7 @@ Gem::Specification.new do |s|
21
21
  "VERSION.yml",
22
22
  "init.rb",
23
23
  "lib/searchlogic.rb",
24
+ "lib/searchlogic/active_record_consistency.rb",
24
25
  "lib/searchlogic/core_ext/object.rb",
25
26
  "lib/searchlogic/core_ext/proc.rb",
26
27
  "lib/searchlogic/named_scopes/alias_scope.rb",
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.3
4
+ version: 2.1.4
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-10 00:00:00 -07:00
12
+ date: 2009-07-12 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -40,6 +40,7 @@ files:
40
40
  - VERSION.yml
41
41
  - init.rb
42
42
  - lib/searchlogic.rb
43
+ - lib/searchlogic/active_record_consistency.rb
43
44
  - lib/searchlogic/core_ext/object.rb
44
45
  - lib/searchlogic/core_ext/proc.rb
45
46
  - lib/searchlogic/named_scopes/alias_scope.rb