Permalink
Browse files

Updated searchgasm;

  • Loading branch information...
1 parent 80ec144 commit e756607949eab0de1734ab307d88101ad4c984fc @binarylogic committed Oct 2, 2008
@@ -1,4 +1,9 @@
-== 1.3.0 released 2008-09-29
+== 1.3.1 released 2008-10-02
+
+* Fixed bug when requiring a connection adapter that is not present
+* Fixes bug in "not" conditions
+
+== 1.3.0 released 2008-10-02
* Added modifiers into the mix: hour_of_created_at_less_than = 10, etc.
* Changed how the Searchgasm::Conditions::Base class works. Instead of predefining all methods for all conditions upon instantiation, they are defined as needed via method_missing. Similar to
@@ -1,11 +1,16 @@
$:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
-
+
+require "active_support"
require "active_record"
require "active_record/version"
-require "active_record/connection_adapters/mysql_adapter"
-require "active_record/connection_adapters/postgresql_adapter"
-require "active_record/connection_adapters/sqlite_adapter"
-require "active_support"
+
+["mysql", "postgresql", "sqlite"].each do |adapter_name|
+ begin
+ require "active_record/connection_adapters/#{adapter_name}_adapter"
+ require "searchgasm/active_record/connection_adapters/#{adapter_name}_adapter"
+ rescue Exception
+ end
+end
# Core Ext
require "searchgasm/core_ext/hash"
@@ -21,9 +26,6 @@
# ActiveRecord
require "searchgasm/active_record/base"
require "searchgasm/active_record/associations"
-require "searchgasm/active_record/connection_adapters/mysql_adapter"
-require "searchgasm/active_record/connection_adapters/postgresql_adapter"
-require "searchgasm/active_record/connection_adapters/sqlite_adapter"
# Search
require "searchgasm/search/ordering"
@@ -10,7 +10,10 @@ def condition_names_for_column
def to_conditions(value)
begin_with = BeginWith.new
begin_with.value = value
- being_with.to_conditions.gsub(" LIKE ", " NOT LIKE ")
+ conditions = being_with.to_conditions
+ return conditions if conditions.blank?
+ conditions.first.gsub!(" LIKE ", " NOT LIKE ")
+ conditions
end
end
end
@@ -10,7 +10,10 @@ def condition_names_for_column
def to_conditions(value)
ends_with = EndsWith.new
ends_with.value = value
- ends_with.to_conditions.gsub(" LIKE ", " NOT LIKE ")
+ conditions = ends_with.to_conditions
+ return conditions if conditions.blank?
+ conditions.first.gsub!(" LIKE ", " NOT LIKE ")
+ conditions
end
end
end
@@ -10,7 +10,10 @@ def condition_names_for_column
def to_conditions(value)
keywords = Keywords.new
keywords.value = value
- keywords.to_conditions.gsub(" LIKE ", " NOT LIKE ")
+ conditions = keywords.to_conditions
+ return conditions if conditions.blank?
+ conditions.first.gsub!(" LIKE ", " NOT LIKE ")
+ conditions
end
end
end
@@ -10,7 +10,10 @@ def condition_names_for_column
def to_conditions(value)
like = Like.new
like.value = value
- like.to_conditions.gsub(" LIKE ", " NOT LIKE ")
+ conditions = like.to_conditions
+ return conditions if conditions.blank?
+ conditions.first.gsub!(" LIKE ", " NOT LIKE ")
+ conditions
end
end
end

0 comments on commit e756607

Please sign in to comment.