Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Released v1.3.3

  • Loading branch information...
commit 86b3719002eee7df5fb075afa40db1ec0b369920 1 parent da7da3b
@binarylogic binarylogic authored
View
3  CHANGELOG.rdoc
@@ -1,6 +1,9 @@
== 1.3.3 released 2008-10-03
* Fixed modifiers being double escaped on equals condition
+* Fixed bug when merging conditions with array substitutions
+* Updated blank condition to check if the values is false or not
+* Fixed type for the year modifier in the mysql adapter
== 1.3.2 released 2008-10-03
View
4 lib/searchgasm/condition/blank.rb
@@ -11,9 +11,9 @@ def condition_names_for_column
def to_conditions(value)
if value == true
- "#{column_sql} is NULL or #{column_sql} = ''"
+ "#{column_sql} is NULL or #{column_sql} = '' or #{column_sql} = false"
elsif value == false
- "#{column_sql} is NOT NULL and #{column_sql} != ''"
+ "#{column_sql} is NOT NULL and #{column_sql} != '' and #{column_sql} != false"
end
end
end
View
10 lib/searchgasm/condition/equals.rb
@@ -12,7 +12,15 @@ def condition_names_for_column
def to_conditions(value)
# Let ActiveRecord handle this
- ["#{column_sql} #{klass.send(:attribute_condition, value)}", *klass.send(:expand_range_bind_variables, [value])]
+ args = []
+ case value
+ when Range
+ args = [value.first, value.last]
+ else
+ args << value
+ end
+
+ ["#{column_sql} #{klass.send(:attribute_condition, value)}", *args]
end
end
end
View
2  lib/searchgasm/helpers/utilities.rb
@@ -1,6 +1,6 @@
module Searchgasm
module Helpers #:nodoc:
- module Utilities # :nodoc:
+ module Utilities
# Builds a hash of params for creating a url and preserves any existing params. You can pass this into url_for and build your url. Although most rails helpers accept a hash.
#
# Let's take the page_link helper. Here is the code behind that helper:
View
2  lib/searchgasm/shared/utilities.rb
@@ -13,7 +13,7 @@ def merge_conditions(*conditions)
conditions.each do |condition|
next if condition.blank?
- arr_condition = [condition].flatten
+ arr_condition = condition.is_a?(Array) ? condition : [condition]
conditions_strs << arr_condition.first
conditions_subs += arr_condition[1..-1]
end
View
2  lib/searchgasm/version.rb
@@ -67,7 +67,7 @@ def to_a
MAJOR = 1
MINOR = 3
- TINY = 2
+ TINY = 3
# The current version as a Version instance
CURRENT = new(MAJOR, MINOR, TINY)
View
8 test/test_condition_types.rb
@@ -8,19 +8,19 @@ def test_sanitize
condition = Searchgasm::Condition::Blank.new(Account, Account.columns_hash["id"])
condition.value = "true"
- assert_equal "\"accounts\".\"id\" is NULL or \"accounts\".\"id\" = ''", condition.sanitize
+ assert_equal "\"accounts\".\"id\" is NULL or \"accounts\".\"id\" = '' or \"accounts\".\"id\" = false", condition.sanitize
condition = Searchgasm::Condition::Blank.new(Account, Account.columns_hash["id"])
condition.value = "false"
- assert_equal "\"accounts\".\"id\" is NOT NULL and \"accounts\".\"id\" != ''", condition.sanitize
+ assert_equal "\"accounts\".\"id\" is NOT NULL and \"accounts\".\"id\" != '' and \"accounts\".\"id\" != false", condition.sanitize
condition = Searchgasm::Condition::Blank.new(Account, Account.columns_hash["id"])
condition.value = true
- assert_equal "\"accounts\".\"id\" is NULL or \"accounts\".\"id\" = ''", condition.sanitize
+ assert_equal "\"accounts\".\"id\" is NULL or \"accounts\".\"id\" = '' or \"accounts\".\"id\" = false", condition.sanitize
condition = Searchgasm::Condition::Blank.new(Account, Account.columns_hash["id"])
condition.value = false
- assert_equal "\"accounts\".\"id\" is NOT NULL and \"accounts\".\"id\" != ''", condition.sanitize
+ assert_equal "\"accounts\".\"id\" is NOT NULL and \"accounts\".\"id\" != '' and \"accounts\".\"id\" != false", condition.sanitize
condition = Searchgasm::Condition::Blank.new(Account, Account.columns_hash["id"])
condition.value = nil
Please sign in to comment.
Something went wrong with that request. Please try again.