searchlogic 1.6.0 → 1.6.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,9 @@
1
+ == 1.6.1 released 2008-12-8
2
+
3
+ * Group multi faceted conditions since we allow for the mix of "and" and "or"
4
+ * Blank arrays are not meaningful values for conditions
5
+ * Add in a unique identifier for the auto-generated hidden fields so that multiple forms do no present a problem.
6
+
1
7
  == 1.6.0 released 2008-12-8
2
8
 
3
9
  * Converted all tree conditions to nested set conditions for performance reasons. A nested set data structure is now required instead of a tree
data/Manifest CHANGED
@@ -101,7 +101,6 @@ lib/searchlogic/shared/utilities.rb
101
101
  lib/searchlogic/shared/virtual_classes.rb
102
102
  lib/searchlogic/version.rb
103
103
  lib/searchlogic.rb
104
- Manifest
105
104
  MIT-LICENSE
106
105
  Rakefile
107
106
  README.rdoc
@@ -155,3 +154,4 @@ test/search_tests/pagination_test.rb
155
154
  test/search_tests/protection_test.rb
156
155
  test/test_helper.rb
157
156
  TODO.rdoc
157
+ Manifest
data/Rakefile CHANGED
@@ -1,19 +1,13 @@
1
1
  require 'rubygems'
2
2
  require File.dirname(__FILE__) << "/lib/searchlogic/version"
3
+ require 'echoe'
3
4
 
4
- begin
5
- require 'echoe'
6
-
7
- Echoe.new 'searchlogic' do |p|
8
- p.version = Searchlogic::Version::STRING
9
- p.author = "Ben Johnson of Binary Logic"
10
- p.email = 'bjohnson@binarylogic.com'
11
- p.project = 'searchlogic'
12
- p.summary = "Object based ActiveRecord searching, ordering, pagination, and more!"
13
- p.url = "http://github.com/binarylogic/searchlogic"
14
- p.dependencies = %w(activerecord activesupport)
15
- end
16
- rescue LoadError => boom
17
- puts "You are missing a dependency required for meta-operations on this gem."
18
- puts "#{boom.to_s.capitalize}."
5
+ Echoe.new 'searchlogic' do |p|
6
+ p.version = Searchlogic::Version::STRING
7
+ p.author = "Ben Johnson of Binary Logic"
8
+ p.email = 'bjohnson@binarylogic.com'
9
+ p.project = 'searchlogic'
10
+ p.summary = "Object based ActiveRecord searching, ordering, pagination, and more!"
11
+ p.url = "http://github.com/binarylogic/searchlogic"
12
+ p.dependencies = %w(activerecord activesupport echoe)
19
13
  end
@@ -90,7 +90,7 @@ module Searchlogic
90
90
  return if value_is_meaningless?
91
91
  v = alt_value || value
92
92
  if v.is_a?(Array) && !self.class.handle_array_value?
93
- merge_conditions(*v.collect { |i| sanitize(i) } << {:any => self.class.join_arrays_with_or?})
93
+ scope_condition(merge_conditions(*v.collect { |i| sanitize(i) } << {:any => self.class.join_arrays_with_or?}))
94
94
  else
95
95
  v = v.utc if column && v.respond_to?(:utc) && [:time, :timestamp, :datetime].include?(column.type) && klass.time_zone_aware_attributes && !klass.skip_time_zone_conversion_for_attributes.include?(column.name.to_sym)
96
96
  to_conditions(v)
@@ -121,7 +121,8 @@ module Searchlogic
121
121
  def meaningless?(v)
122
122
  case v
123
123
  when Array
124
- false
124
+ v.each { |i| return false unless meaningless?(i) }
125
+ true
125
126
  else
126
127
  !explicitly_set_value? || (self.class.ignore_meaningless_value? && v != false && v.blank?)
127
128
  end
@@ -11,9 +11,9 @@ module Searchlogic
11
11
 
12
12
  def to_conditions(value)
13
13
  if value == true
14
- "#{column_sql} IS NULL or #{column_sql} = '' or #{column_sql} = false"
14
+ "(#{column_sql} IS NULL or #{column_sql} = '' or #{column_sql} = false)"
15
15
  elsif value == false
16
- "#{column_sql} IS NOT NULL and #{column_sql} != '' and #{column_sql} != false"
16
+ "(#{column_sql} IS NOT NULL and #{column_sql} != '' and #{column_sql} != false)"
17
17
  end
18
18
  end
19
19
  end
@@ -4,7 +4,7 @@ module Searchlogic
4
4
  def to_conditions(value)
5
5
  condition = InclusiveDescendantOf.new(klass, options)
6
6
  condition.value = value
7
- merge_conditions(["#{quoted_table_name}.#{quote_column_name(klass.primary_key)} != ?", (value.is_a?(klass) ? value.send(klass.primary_key) : value)], condition.sanitize)
7
+ scope_condition(merge_conditions(["#{quoted_table_name}.#{quote_column_name(klass.primary_key)} != ?", (value.is_a?(klass) ? value.send(klass.primary_key) : value)], condition.sanitize))
8
8
  end
9
9
  end
10
10
  end
@@ -11,6 +11,8 @@ module Searchlogic
11
11
  end
12
12
 
13
13
  def to_conditions(value)
14
+ return value if value.is_a?(Array) && value.empty?
15
+
14
16
  # Let ActiveRecord handle this
15
17
  args = []
16
18
  case value
@@ -3,7 +3,7 @@ module Searchlogic
3
3
  class InclusiveDescendantOf < NestedSet
4
4
  def to_conditions(value)
5
5
  root = (value.is_a?(klass) ? value : klass.find(value)) rescue return
6
- ["#{quoted_table_name}.#{quote_column_name(klass.left_column_name)} >= ? AND #{quoted_table_name}.#{quote_column_name(klass.right_column_name)} <= ?", root.left, root.right]
6
+ ["(#{quoted_table_name}.#{quote_column_name(klass.left_column_name)} >= ? AND #{quoted_table_name}.#{quote_column_name(klass.right_column_name)} <= ?)", root.left, root.right]
7
7
  end
8
8
  end
9
9
  end
@@ -15,6 +15,7 @@ module Searchlogic
15
15
  condition = Equals.new(klass, options)
16
16
  condition.value = value
17
17
  conditions_array = condition.sanitize
18
+ return conditions_array if conditions_array.blank?
18
19
  conditions_array.first.gsub!(/ IS /, " IS NOT ")
19
20
  conditions_array.first.gsub!(/ BETWEEN /, " NOT BETWEEN ")
20
21
  conditions_array.first.gsub!(/ IN /, " NOT IN ")
@@ -245,7 +245,6 @@ module Searchlogic
245
245
  def #{name}=(value)
246
246
  @conditions = nil
247
247
  #{name}_object.value = value
248
- reset_#{name}! if #{name}_object.value_is_meaningless?
249
248
  value
250
249
  end
251
250
 
@@ -93,9 +93,9 @@ module Searchlogic
93
93
 
94
94
  javascript = ""
95
95
  javascript += "if(typeof(Prototype) != 'undefined') {" if Config.helpers.javascript_library.blank?
96
- search_options[:hidden_fields].each { |field| javascript += "field = $('#{name}_#{field}'); if(field) { $('#{name}_#{field}_hidden').value = field.value; }" } if Config.helpers.javascript_library.blank? || Config.helpers.javascript_library == :prototype
96
+ search_options[:hidden_fields].each { |field| javascript += "field = $('#{name}_#{field}'); if(field) { $('#{name}_#{field}_#{options.object_id}').value = field.value; }" } if Config.helpers.javascript_library.blank? || Config.helpers.javascript_library == :prototype
97
97
  javascript += "} else if(typeof(jQuery) != 'undefined') {" if Config.helpers.javascript_library.blank?
98
- search_options[:hidden_fields].each { |field| javascript += "field = $('##{name}_#{field}'); if(field) { $('##{name}_#{field}_hidden').val(field.val()); }" } if Config.helpers.javascript_library.blank? || Config.helpers.javascript_library == :jquery
98
+ search_options[:hidden_fields].each { |field| javascript += "field = $('##{name}_#{field}'); if(field) { $('##{name}_#{field}_#{options.object_id}').val(field.val()); }" } if Config.helpers.javascript_library.blank? || Config.helpers.javascript_library == :jquery
99
99
  javascript += "}" if Config.helpers.javascript_library.blank?
100
100
 
101
101
  options[:html][:onsubmit] += javascript
@@ -123,7 +123,7 @@ module Searchlogic
123
123
  options = args.extract_options!
124
124
  options
125
125
  search_options[:hidden_fields].each do |field|
126
- html = hidden_field(name, field, :object => search_object, :id => "#{name}_#{field}_hidden", :value => (field == :order_by ? searchlogic_base64_value(search_object.order_by) : search_object.send(field)))
126
+ html = hidden_field(name, field, :object => search_object, :id => "#{name}_#{field}_#{options.object_id}", :value => (field == :order_by ? searchlogic_base64_value(search_object.order_by) : search_object.send(field)))
127
127
 
128
128
  # For edge rails and older version compatibility, passing a binding to concat was deprecated
129
129
  begin
@@ -67,7 +67,7 @@ module Searchlogic
67
67
 
68
68
  MAJOR = 1
69
69
  MINOR = 6
70
- TINY = 0
70
+ TINY = 1
71
71
 
72
72
  # The current version as a Version instance
73
73
  CURRENT = new(MAJOR, MINOR, TINY)
data/searchlogic.gemspec CHANGED
@@ -2,15 +2,15 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{searchlogic}
5
- s.version = "1.6.0"
5
+ s.version = "1.6.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Ben Johnson of Binary Logic"]
9
- s.date = %q{2008-12-08}
9
+ s.date = %q{2008-12-11}
10
10
  s.description = %q{Object based ActiveRecord searching, ordering, pagination, and more!}
11
11
  s.email = %q{bjohnson@binarylogic.com}
12
12
  s.extra_rdoc_files = ["CHANGELOG.rdoc", "lib/searchlogic/active_record/associations.rb", "lib/searchlogic/active_record/base.rb", "lib/searchlogic/active_record/connection_adapters/mysql_adapter.rb", "lib/searchlogic/active_record/connection_adapters/postgresql_adapter.rb", "lib/searchlogic/active_record/connection_adapters/sqlite_adapter.rb", "lib/searchlogic/condition/base.rb", "lib/searchlogic/condition/begins_with.rb", "lib/searchlogic/condition/blank.rb", "lib/searchlogic/condition/child_of.rb", "lib/searchlogic/condition/descendant_of.rb", "lib/searchlogic/condition/ends_with.rb", "lib/searchlogic/condition/equals.rb", "lib/searchlogic/condition/greater_than.rb", "lib/searchlogic/condition/greater_than_or_equal_to.rb", "lib/searchlogic/condition/inclusive_descendant_of.rb", "lib/searchlogic/condition/keywords.rb", "lib/searchlogic/condition/less_than.rb", "lib/searchlogic/condition/less_than_or_equal_to.rb", "lib/searchlogic/condition/like.rb", "lib/searchlogic/condition/nested_set.rb", "lib/searchlogic/condition/nil.rb", "lib/searchlogic/condition/not_begin_with.rb", "lib/searchlogic/condition/not_blank.rb", "lib/searchlogic/condition/not_end_with.rb", "lib/searchlogic/condition/not_equal.rb", "lib/searchlogic/condition/not_have_keywords.rb", "lib/searchlogic/condition/not_like.rb", "lib/searchlogic/condition/not_nil.rb", "lib/searchlogic/condition/sibling_of.rb", "lib/searchlogic/conditions/any_or_all.rb", "lib/searchlogic/conditions/base.rb", "lib/searchlogic/conditions/groups.rb", "lib/searchlogic/conditions/magic_methods.rb", "lib/searchlogic/conditions/multiparameter_attributes.rb", "lib/searchlogic/conditions/protection.rb", "lib/searchlogic/config/helpers.rb", "lib/searchlogic/config/search.rb", "lib/searchlogic/config.rb", "lib/searchlogic/core_ext/hash.rb", "lib/searchlogic/core_ext/object.rb", "lib/searchlogic/helpers/control_types/link.rb", "lib/searchlogic/helpers/control_types/links.rb", "lib/searchlogic/helpers/control_types/remote_link.rb", "lib/searchlogic/helpers/control_types/remote_links.rb", "lib/searchlogic/helpers/control_types/remote_select.rb", "lib/searchlogic/helpers/control_types/select.rb", "lib/searchlogic/helpers/form.rb", "lib/searchlogic/helpers/utilities.rb", "lib/searchlogic/modifiers/absolute.rb", "lib/searchlogic/modifiers/acos.rb", "lib/searchlogic/modifiers/asin.rb", "lib/searchlogic/modifiers/atan.rb", "lib/searchlogic/modifiers/avg.rb", "lib/searchlogic/modifiers/base.rb", "lib/searchlogic/modifiers/ceil.rb", "lib/searchlogic/modifiers/char_length.rb", "lib/searchlogic/modifiers/cos.rb", "lib/searchlogic/modifiers/cot.rb", "lib/searchlogic/modifiers/count.rb", "lib/searchlogic/modifiers/day_of_month.rb", "lib/searchlogic/modifiers/day_of_week.rb", "lib/searchlogic/modifiers/day_of_year.rb", "lib/searchlogic/modifiers/degrees.rb", "lib/searchlogic/modifiers/exp.rb", "lib/searchlogic/modifiers/floor.rb", "lib/searchlogic/modifiers/hex.rb", "lib/searchlogic/modifiers/hour.rb", "lib/searchlogic/modifiers/log.rb", "lib/searchlogic/modifiers/log10.rb", "lib/searchlogic/modifiers/log2.rb", "lib/searchlogic/modifiers/lower.rb", "lib/searchlogic/modifiers/ltrim.rb", "lib/searchlogic/modifiers/md5.rb", "lib/searchlogic/modifiers/microseconds.rb", "lib/searchlogic/modifiers/milliseconds.rb", "lib/searchlogic/modifiers/minute.rb", "lib/searchlogic/modifiers/month.rb", "lib/searchlogic/modifiers/octal.rb", "lib/searchlogic/modifiers/radians.rb", "lib/searchlogic/modifiers/round.rb", "lib/searchlogic/modifiers/rtrim.rb", "lib/searchlogic/modifiers/second.rb", "lib/searchlogic/modifiers/sign.rb", "lib/searchlogic/modifiers/sin.rb", "lib/searchlogic/modifiers/square_root.rb", "lib/searchlogic/modifiers/sum.rb", "lib/searchlogic/modifiers/tan.rb", "lib/searchlogic/modifiers/trim.rb", "lib/searchlogic/modifiers/upper.rb", "lib/searchlogic/modifiers/week.rb", "lib/searchlogic/modifiers/year.rb", "lib/searchlogic/search/base.rb", "lib/searchlogic/search/conditions.rb", "lib/searchlogic/search/ordering.rb", "lib/searchlogic/search/pagination.rb", "lib/searchlogic/search/protection.rb", "lib/searchlogic/search/searching.rb", "lib/searchlogic/shared/utilities.rb", "lib/searchlogic/shared/virtual_classes.rb", "lib/searchlogic/version.rb", "lib/searchlogic.rb", "README.rdoc", "TODO.rdoc"]
13
- s.files = ["CHANGELOG.rdoc", "init.rb", "lib/searchlogic/active_record/associations.rb", "lib/searchlogic/active_record/base.rb", "lib/searchlogic/active_record/connection_adapters/mysql_adapter.rb", "lib/searchlogic/active_record/connection_adapters/postgresql_adapter.rb", "lib/searchlogic/active_record/connection_adapters/sqlite_adapter.rb", "lib/searchlogic/condition/base.rb", "lib/searchlogic/condition/begins_with.rb", "lib/searchlogic/condition/blank.rb", "lib/searchlogic/condition/child_of.rb", "lib/searchlogic/condition/descendant_of.rb", "lib/searchlogic/condition/ends_with.rb", "lib/searchlogic/condition/equals.rb", "lib/searchlogic/condition/greater_than.rb", "lib/searchlogic/condition/greater_than_or_equal_to.rb", "lib/searchlogic/condition/inclusive_descendant_of.rb", "lib/searchlogic/condition/keywords.rb", "lib/searchlogic/condition/less_than.rb", "lib/searchlogic/condition/less_than_or_equal_to.rb", "lib/searchlogic/condition/like.rb", "lib/searchlogic/condition/nested_set.rb", "lib/searchlogic/condition/nil.rb", "lib/searchlogic/condition/not_begin_with.rb", "lib/searchlogic/condition/not_blank.rb", "lib/searchlogic/condition/not_end_with.rb", "lib/searchlogic/condition/not_equal.rb", "lib/searchlogic/condition/not_have_keywords.rb", "lib/searchlogic/condition/not_like.rb", "lib/searchlogic/condition/not_nil.rb", "lib/searchlogic/condition/sibling_of.rb", "lib/searchlogic/conditions/any_or_all.rb", "lib/searchlogic/conditions/base.rb", "lib/searchlogic/conditions/groups.rb", "lib/searchlogic/conditions/magic_methods.rb", "lib/searchlogic/conditions/multiparameter_attributes.rb", "lib/searchlogic/conditions/protection.rb", "lib/searchlogic/config/helpers.rb", "lib/searchlogic/config/search.rb", "lib/searchlogic/config.rb", "lib/searchlogic/core_ext/hash.rb", "lib/searchlogic/core_ext/object.rb", "lib/searchlogic/helpers/control_types/link.rb", "lib/searchlogic/helpers/control_types/links.rb", "lib/searchlogic/helpers/control_types/remote_link.rb", "lib/searchlogic/helpers/control_types/remote_links.rb", "lib/searchlogic/helpers/control_types/remote_select.rb", "lib/searchlogic/helpers/control_types/select.rb", "lib/searchlogic/helpers/form.rb", "lib/searchlogic/helpers/utilities.rb", "lib/searchlogic/modifiers/absolute.rb", "lib/searchlogic/modifiers/acos.rb", "lib/searchlogic/modifiers/asin.rb", "lib/searchlogic/modifiers/atan.rb", "lib/searchlogic/modifiers/avg.rb", "lib/searchlogic/modifiers/base.rb", "lib/searchlogic/modifiers/ceil.rb", "lib/searchlogic/modifiers/char_length.rb", "lib/searchlogic/modifiers/cos.rb", "lib/searchlogic/modifiers/cot.rb", "lib/searchlogic/modifiers/count.rb", "lib/searchlogic/modifiers/day_of_month.rb", "lib/searchlogic/modifiers/day_of_week.rb", "lib/searchlogic/modifiers/day_of_year.rb", "lib/searchlogic/modifiers/degrees.rb", "lib/searchlogic/modifiers/exp.rb", "lib/searchlogic/modifiers/floor.rb", "lib/searchlogic/modifiers/hex.rb", "lib/searchlogic/modifiers/hour.rb", "lib/searchlogic/modifiers/log.rb", "lib/searchlogic/modifiers/log10.rb", "lib/searchlogic/modifiers/log2.rb", "lib/searchlogic/modifiers/lower.rb", "lib/searchlogic/modifiers/ltrim.rb", "lib/searchlogic/modifiers/md5.rb", "lib/searchlogic/modifiers/microseconds.rb", "lib/searchlogic/modifiers/milliseconds.rb", "lib/searchlogic/modifiers/minute.rb", "lib/searchlogic/modifiers/month.rb", "lib/searchlogic/modifiers/octal.rb", "lib/searchlogic/modifiers/radians.rb", "lib/searchlogic/modifiers/round.rb", "lib/searchlogic/modifiers/rtrim.rb", "lib/searchlogic/modifiers/second.rb", "lib/searchlogic/modifiers/sign.rb", "lib/searchlogic/modifiers/sin.rb", "lib/searchlogic/modifiers/square_root.rb", "lib/searchlogic/modifiers/sum.rb", "lib/searchlogic/modifiers/tan.rb", "lib/searchlogic/modifiers/trim.rb", "lib/searchlogic/modifiers/upper.rb", "lib/searchlogic/modifiers/week.rb", "lib/searchlogic/modifiers/year.rb", "lib/searchlogic/search/base.rb", "lib/searchlogic/search/conditions.rb", "lib/searchlogic/search/ordering.rb", "lib/searchlogic/search/pagination.rb", "lib/searchlogic/search/protection.rb", "lib/searchlogic/search/searching.rb", "lib/searchlogic/shared/utilities.rb", "lib/searchlogic/shared/virtual_classes.rb", "lib/searchlogic/version.rb", "lib/searchlogic.rb", "Manifest", "MIT-LICENSE", "Rakefile", "README.rdoc", "test/active_record_tests/associations_test.rb", "test/active_record_tests/base_test.rb", "test/condition_tests/base_test.rb", "test/condition_tests/begins_with_test.rb", "test/condition_tests/blank_test.rb", "test/condition_tests/child_of_test.rb", "test/condition_tests/descendant_of_test.rb", "test/condition_tests/ends_with_test.rb", "test/condition_tests/equals_test.rb", "test/condition_tests/greater_than_or_equal_to_test.rb", "test/condition_tests/greater_than_test.rb", "test/condition_tests/inclusive_descendant_of_test.rb", "test/condition_tests/keywords_test.rb", "test/condition_tests/less_than_or_equal_to_test.rb", "test/condition_tests/less_than_test.rb", "test/condition_tests/like_test.rb", "test/condition_tests/nil_test.rb", "test/condition_tests/not_begin_with_test.rb", "test/condition_tests/not_blank_test.rb", "test/condition_tests/not_end_with_test.rb", "test/condition_tests/not_equal_test.rb", "test/condition_tests/not_have_keywords_test.rb", "test/condition_tests/not_like_test.rb", "test/condition_tests/not_nil_test.rb", "test/condition_tests/sibling_of_test.rb", "test/conditions_tests/any_or_all_test.rb", "test/conditions_tests/base_test.rb", "test/conditions_tests/groups_test.rb", "test/conditions_tests/magic_methods_test.rb", "test/conditions_tests/multiparameter_attributes_test.rb", "test/conditions_tests/protection_test.rb", "test/config_test.rb", "test/fixtures/accounts.yml", "test/fixtures/animals.yml", "test/fixtures/orders.yml", "test/fixtures/user_groups.yml", "test/fixtures/users.yml", "test/libs/awesome_nested_set/compatability.rb", "test/libs/awesome_nested_set/helper.rb", "test/libs/awesome_nested_set/named_scope.rb", "test/libs/awesome_nested_set.rb", "test/libs/rexml_fix.rb", "test/modifier_tests/day_of_month_test.rb", "test/search_tests/base_test.rb", "test/search_tests/conditions_test.rb", "test/search_tests/ordering_test.rb", "test/search_tests/pagination_test.rb", "test/search_tests/protection_test.rb", "test/test_helper.rb", "TODO.rdoc", "searchlogic.gemspec"]
13
+ s.files = ["CHANGELOG.rdoc", "init.rb", "lib/searchlogic/active_record/associations.rb", "lib/searchlogic/active_record/base.rb", "lib/searchlogic/active_record/connection_adapters/mysql_adapter.rb", "lib/searchlogic/active_record/connection_adapters/postgresql_adapter.rb", "lib/searchlogic/active_record/connection_adapters/sqlite_adapter.rb", "lib/searchlogic/condition/base.rb", "lib/searchlogic/condition/begins_with.rb", "lib/searchlogic/condition/blank.rb", "lib/searchlogic/condition/child_of.rb", "lib/searchlogic/condition/descendant_of.rb", "lib/searchlogic/condition/ends_with.rb", "lib/searchlogic/condition/equals.rb", "lib/searchlogic/condition/greater_than.rb", "lib/searchlogic/condition/greater_than_or_equal_to.rb", "lib/searchlogic/condition/inclusive_descendant_of.rb", "lib/searchlogic/condition/keywords.rb", "lib/searchlogic/condition/less_than.rb", "lib/searchlogic/condition/less_than_or_equal_to.rb", "lib/searchlogic/condition/like.rb", "lib/searchlogic/condition/nested_set.rb", "lib/searchlogic/condition/nil.rb", "lib/searchlogic/condition/not_begin_with.rb", "lib/searchlogic/condition/not_blank.rb", "lib/searchlogic/condition/not_end_with.rb", "lib/searchlogic/condition/not_equal.rb", "lib/searchlogic/condition/not_have_keywords.rb", "lib/searchlogic/condition/not_like.rb", "lib/searchlogic/condition/not_nil.rb", "lib/searchlogic/condition/sibling_of.rb", "lib/searchlogic/conditions/any_or_all.rb", "lib/searchlogic/conditions/base.rb", "lib/searchlogic/conditions/groups.rb", "lib/searchlogic/conditions/magic_methods.rb", "lib/searchlogic/conditions/multiparameter_attributes.rb", "lib/searchlogic/conditions/protection.rb", "lib/searchlogic/config/helpers.rb", "lib/searchlogic/config/search.rb", "lib/searchlogic/config.rb", "lib/searchlogic/core_ext/hash.rb", "lib/searchlogic/core_ext/object.rb", "lib/searchlogic/helpers/control_types/link.rb", "lib/searchlogic/helpers/control_types/links.rb", "lib/searchlogic/helpers/control_types/remote_link.rb", "lib/searchlogic/helpers/control_types/remote_links.rb", "lib/searchlogic/helpers/control_types/remote_select.rb", "lib/searchlogic/helpers/control_types/select.rb", "lib/searchlogic/helpers/form.rb", "lib/searchlogic/helpers/utilities.rb", "lib/searchlogic/modifiers/absolute.rb", "lib/searchlogic/modifiers/acos.rb", "lib/searchlogic/modifiers/asin.rb", "lib/searchlogic/modifiers/atan.rb", "lib/searchlogic/modifiers/avg.rb", "lib/searchlogic/modifiers/base.rb", "lib/searchlogic/modifiers/ceil.rb", "lib/searchlogic/modifiers/char_length.rb", "lib/searchlogic/modifiers/cos.rb", "lib/searchlogic/modifiers/cot.rb", "lib/searchlogic/modifiers/count.rb", "lib/searchlogic/modifiers/day_of_month.rb", "lib/searchlogic/modifiers/day_of_week.rb", "lib/searchlogic/modifiers/day_of_year.rb", "lib/searchlogic/modifiers/degrees.rb", "lib/searchlogic/modifiers/exp.rb", "lib/searchlogic/modifiers/floor.rb", "lib/searchlogic/modifiers/hex.rb", "lib/searchlogic/modifiers/hour.rb", "lib/searchlogic/modifiers/log.rb", "lib/searchlogic/modifiers/log10.rb", "lib/searchlogic/modifiers/log2.rb", "lib/searchlogic/modifiers/lower.rb", "lib/searchlogic/modifiers/ltrim.rb", "lib/searchlogic/modifiers/md5.rb", "lib/searchlogic/modifiers/microseconds.rb", "lib/searchlogic/modifiers/milliseconds.rb", "lib/searchlogic/modifiers/minute.rb", "lib/searchlogic/modifiers/month.rb", "lib/searchlogic/modifiers/octal.rb", "lib/searchlogic/modifiers/radians.rb", "lib/searchlogic/modifiers/round.rb", "lib/searchlogic/modifiers/rtrim.rb", "lib/searchlogic/modifiers/second.rb", "lib/searchlogic/modifiers/sign.rb", "lib/searchlogic/modifiers/sin.rb", "lib/searchlogic/modifiers/square_root.rb", "lib/searchlogic/modifiers/sum.rb", "lib/searchlogic/modifiers/tan.rb", "lib/searchlogic/modifiers/trim.rb", "lib/searchlogic/modifiers/upper.rb", "lib/searchlogic/modifiers/week.rb", "lib/searchlogic/modifiers/year.rb", "lib/searchlogic/search/base.rb", "lib/searchlogic/search/conditions.rb", "lib/searchlogic/search/ordering.rb", "lib/searchlogic/search/pagination.rb", "lib/searchlogic/search/protection.rb", "lib/searchlogic/search/searching.rb", "lib/searchlogic/shared/utilities.rb", "lib/searchlogic/shared/virtual_classes.rb", "lib/searchlogic/version.rb", "lib/searchlogic.rb", "MIT-LICENSE", "Rakefile", "README.rdoc", "test/active_record_tests/associations_test.rb", "test/active_record_tests/base_test.rb", "test/condition_tests/base_test.rb", "test/condition_tests/begins_with_test.rb", "test/condition_tests/blank_test.rb", "test/condition_tests/child_of_test.rb", "test/condition_tests/descendant_of_test.rb", "test/condition_tests/ends_with_test.rb", "test/condition_tests/equals_test.rb", "test/condition_tests/greater_than_or_equal_to_test.rb", "test/condition_tests/greater_than_test.rb", "test/condition_tests/inclusive_descendant_of_test.rb", "test/condition_tests/keywords_test.rb", "test/condition_tests/less_than_or_equal_to_test.rb", "test/condition_tests/less_than_test.rb", "test/condition_tests/like_test.rb", "test/condition_tests/nil_test.rb", "test/condition_tests/not_begin_with_test.rb", "test/condition_tests/not_blank_test.rb", "test/condition_tests/not_end_with_test.rb", "test/condition_tests/not_equal_test.rb", "test/condition_tests/not_have_keywords_test.rb", "test/condition_tests/not_like_test.rb", "test/condition_tests/not_nil_test.rb", "test/condition_tests/sibling_of_test.rb", "test/conditions_tests/any_or_all_test.rb", "test/conditions_tests/base_test.rb", "test/conditions_tests/groups_test.rb", "test/conditions_tests/magic_methods_test.rb", "test/conditions_tests/multiparameter_attributes_test.rb", "test/conditions_tests/protection_test.rb", "test/config_test.rb", "test/fixtures/accounts.yml", "test/fixtures/animals.yml", "test/fixtures/orders.yml", "test/fixtures/user_groups.yml", "test/fixtures/users.yml", "test/libs/awesome_nested_set/compatability.rb", "test/libs/awesome_nested_set/helper.rb", "test/libs/awesome_nested_set/named_scope.rb", "test/libs/awesome_nested_set.rb", "test/libs/rexml_fix.rb", "test/modifier_tests/day_of_month_test.rb", "test/search_tests/base_test.rb", "test/search_tests/conditions_test.rb", "test/search_tests/ordering_test.rb", "test/search_tests/pagination_test.rb", "test/search_tests/protection_test.rb", "test/test_helper.rb", "TODO.rdoc", "Manifest", "searchlogic.gemspec"]
14
14
  s.has_rdoc = true
15
15
  s.homepage = %q{http://github.com/binarylogic/searchlogic}
16
16
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Searchlogic", "--main", "README.rdoc"]
@@ -27,15 +27,18 @@ Gem::Specification.new do |s|
27
27
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
28
28
  s.add_runtime_dependency(%q<activerecord>, [">= 0"])
29
29
  s.add_runtime_dependency(%q<activesupport>, [">= 0"])
30
+ s.add_runtime_dependency(%q<echoe>, [">= 0"])
30
31
  s.add_development_dependency(%q<echoe>, [">= 0"])
31
32
  else
32
33
  s.add_dependency(%q<activerecord>, [">= 0"])
33
34
  s.add_dependency(%q<activesupport>, [">= 0"])
34
35
  s.add_dependency(%q<echoe>, [">= 0"])
36
+ s.add_dependency(%q<echoe>, [">= 0"])
35
37
  end
36
38
  else
37
39
  s.add_dependency(%q<activerecord>, [">= 0"])
38
40
  s.add_dependency(%q<activesupport>, [">= 0"])
39
41
  s.add_dependency(%q<echoe>, [">= 0"])
42
+ s.add_dependency(%q<echoe>, [">= 0"])
40
43
  end
41
44
  end
@@ -5,19 +5,19 @@ module ConditionTests
5
5
  def test_sanitize
6
6
  condition = Searchlogic::Condition::Blank.new(Account, :column => Account.columns_hash["id"])
7
7
  condition.value = "true"
8
- assert_equal "\"accounts\".\"id\" IS NULL or \"accounts\".\"id\" = '' or \"accounts\".\"id\" = false", condition.sanitize
8
+ assert_equal "(\"accounts\".\"id\" IS NULL or \"accounts\".\"id\" = '' or \"accounts\".\"id\" = false)", condition.sanitize
9
9
 
10
10
  condition = Searchlogic::Condition::Blank.new(Account, :column => Account.columns_hash["id"])
11
11
  condition.value = "false"
12
- assert_equal "\"accounts\".\"id\" IS NOT NULL and \"accounts\".\"id\" != '' and \"accounts\".\"id\" != false", condition.sanitize
12
+ assert_equal "(\"accounts\".\"id\" IS NOT NULL and \"accounts\".\"id\" != '' and \"accounts\".\"id\" != false)", condition.sanitize
13
13
 
14
14
  condition = Searchlogic::Condition::Blank.new(Account, :column => Account.columns_hash["id"])
15
15
  condition.value = true
16
- assert_equal "\"accounts\".\"id\" IS NULL or \"accounts\".\"id\" = '' or \"accounts\".\"id\" = false", condition.sanitize
16
+ assert_equal "(\"accounts\".\"id\" IS NULL or \"accounts\".\"id\" = '' or \"accounts\".\"id\" = false)", condition.sanitize
17
17
 
18
18
  condition = Searchlogic::Condition::Blank.new(Account, :column => Account.columns_hash["id"])
19
19
  condition.value = false
20
- assert_equal "\"accounts\".\"id\" IS NOT NULL and \"accounts\".\"id\" != '' and \"accounts\".\"id\" != false", condition.sanitize
20
+ assert_equal "(\"accounts\".\"id\" IS NOT NULL and \"accounts\".\"id\" != '' and \"accounts\".\"id\" != false)", condition.sanitize
21
21
 
22
22
  condition = Searchlogic::Condition::Blank.new(Account, :column => Account.columns_hash["id"])
23
23
  condition.value = nil
@@ -6,7 +6,7 @@ module ConditionTests
6
6
  ben = users(:ben)
7
7
  condition = Searchlogic::Condition::DescendantOf.new(User)
8
8
  condition.value = ben
9
- assert_equal ["\"users\".\"id\" != ? AND \"users\".\"lft\" >= ? AND \"users\".\"rgt\" <= ?", ben.id, ben.left, ben.right], condition.sanitize
9
+ assert_equal ["(\"users\".\"id\" != ? AND (\"users\".\"lft\" >= ? AND \"users\".\"rgt\" <= ?))", ben.id, ben.left, ben.right], condition.sanitize
10
10
  end
11
11
  end
12
12
  end
@@ -10,6 +10,15 @@ module ConditionTests
10
10
  condition = Searchlogic::Condition::Equals.new(Account, :column => Account.columns_hash["id"])
11
11
  condition.value = [1,2,3,4]
12
12
  assert_equal ["\"accounts\".\"id\" IN (?)", [1, 2, 3, 4]], condition.sanitize
13
+
14
+ condition = Searchlogic::Condition::Equals.new(Account, :column => Account.columns_hash["id"])
15
+ condition.value = []
16
+ assert_equal [], condition.value
17
+ assert_nil condition.sanitize
18
+
19
+ search = User.new_search
20
+ search.conditions.id = []
21
+ assert_equal [], search.conditions.id
13
22
 
14
23
  condition = Searchlogic::Condition::Equals.new(Account, :column => Account.columns_hash["id"])
15
24
  condition.value = (1..10)
@@ -6,7 +6,7 @@ module ConditionTests
6
6
  ben = users(:ben)
7
7
  condition = Searchlogic::Condition::InclusiveDescendantOf.new(User)
8
8
  condition.value = ben
9
- assert_equal ["\"users\".\"lft\" >= ? AND \"users\".\"rgt\" <= ?", ben.left, ben.right], condition.sanitize
9
+ assert_equal ["(\"users\".\"lft\" >= ? AND \"users\".\"rgt\" <= ?)", ben.left, ben.right], condition.sanitize
10
10
  end
11
11
  end
12
12
  end
@@ -11,7 +11,7 @@ module ConditionsTests
11
11
  conditions.descendant_of = ["21", "22"]
12
12
  assert_equal [21, 22], conditions.descendant_of
13
13
  conditions.descendant_of = ben
14
- assert_equal ["\"users\".\"id\" != ? AND \"users\".\"lft\" >= ? AND \"users\".\"rgt\" <= ?", ben.id, ben.left, ben.right], conditions.sanitize
14
+ assert_equal ["(\"users\".\"id\" != ? AND (\"users\".\"lft\" >= ? AND \"users\".\"rgt\" <= ?))", ben.id, ben.left, ben.right], conditions.sanitize
15
15
  end
16
16
 
17
17
  def test_virtual_columns
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: searchlogic
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.6.1
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: 2008-12-08 00:00:00 -05:00
12
+ date: 2008-12-11 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -32,6 +32,16 @@ dependencies:
32
32
  - !ruby/object:Gem::Version
33
33
  version: "0"
34
34
  version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: echoe
37
+ type: :runtime
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: "0"
44
+ version:
35
45
  - !ruby/object:Gem::Dependency
36
46
  name: echoe
37
47
  type: :development
@@ -257,7 +267,6 @@ files:
257
267
  - lib/searchlogic/shared/virtual_classes.rb
258
268
  - lib/searchlogic/version.rb
259
269
  - lib/searchlogic.rb
260
- - Manifest
261
270
  - MIT-LICENSE
262
271
  - Rakefile
263
272
  - README.rdoc
@@ -311,6 +320,7 @@ files:
311
320
  - test/search_tests/protection_test.rb
312
321
  - test/test_helper.rb
313
322
  - TODO.rdoc
323
+ - Manifest
314
324
  - searchlogic.gemspec
315
325
  has_rdoc: true
316
326
  homepage: http://github.com/binarylogic/searchlogic