Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Released v1.4.1

  • Loading branch information...
commit 6095cd3412c66391f78c61610e04f4cd4a14040e 1 parent 0f1c1ab
@binarylogic binarylogic authored
View
1  CHANGELOG.rdoc
@@ -1,6 +1,7 @@
== 1.4.1 released 2008-10-08
* Extracted english text into configuration to support alternate languages. I18n support.
+* Improved method detection in add_joins to use respond_to? with the private method option set to true
== 1.4.0 released 2008-10-08
View
3  lib/searchgasm/active_record/base.rb
@@ -175,8 +175,7 @@ def valid_calculations_options
#
# Where as before, the only way to get the above query to work would be to include line_items also, which is not neccessarily what you want.
def add_joins!(sql, options_or_joins, scope = :auto) # :nodoc:
- code_type = array_of_strings?([""]) && :array_of_strings rescue nil
- code_type ||= merge_joins("", "") && :merge_joins rescue nil
+ code_type = (respond_to?(:array_of_strings?, true) && :array_of_strings) || (respond_to?(:merge_joins, true) && :merge_joins)
case code_type
when :array_of_strings, :merge_joins
View
9 lib/searchgasm/search/base.rb
@@ -129,15 +129,6 @@ def scope
end
private
- def joins_to_sql_array(joins)
- unless array_of_strings?(safe_to_array(joins))
- join_dependency = ::ActiveRecord::Associations::ClassMethods::JoinDependency.new(klass, joins, nil)
- join_dependency.join_associations.collect { |assoc| assoc.association_join }
- else
- joins.is_a?(Array) ? joins : safe_to_array(joins)
- end
- end
-
def safe_to_array(o)
case o
when NilClass
View
2  lib/searchgasm/version.rb
@@ -67,7 +67,7 @@ def to_a
MAJOR = 1
MINOR = 4
- TINY = 0
+ TINY = 1
# The current version as a Version instance
CURRENT = new(MAJOR, MINOR, TINY)
View
1  test/test_active_record_base.rb
@@ -45,6 +45,7 @@ def test_searchgasm_searching
assert_equal Account.find(1, 3), Account.all(:conditions => {:name_contains => "Binary"})
assert_equal [Account.find(1)], Account.all(:conditions => {:name_contains => "Binary", :users => {:first_name_starts_with => "Ben"}})
assert_equal [], Account.all(:conditions => {:name_contains => "Binary", :users => {:first_name_starts_with => "Ben", :last_name => "Mills"}})
+ assert_equal Account.find(1, 2), Account.all(:conditions => {:users => {:id_gt => 0}}, :include => :users)
read_only_accounts = Account.all(:conditions => {:name_contains => "Binary"}, :readonly => true)
assert read_only_accounts.first.readonly?
View
18 test/test_search_base.rb
@@ -98,23 +98,23 @@ def test_setting_first_level_options
search.lock = true
assert_equal search.lock, true
end
-=begin
- def test_auto_joins
+
+ def test_joins
search = Account.new_search
- assert_equal nil, search.auto_joins
+ assert_equal nil, search.joins
search.conditions.name_contains = "Binary"
- assert_equal nil, search.auto_joins
+ assert_equal nil, search.joins
search.conditions.users.first_name_contains = "Ben"
- assert_equal(:users, search.auto_joins)
+ assert_equal(:users, search.joins)
search.conditions.users.orders.id_gt = 2
- assert_equal({:users => :orders}, search.auto_joins)
+ assert_equal({:users => :orders}, search.joins)
search.conditions.users.reset_orders!
- assert_equal(:users, search.auto_joins)
+ assert_equal(:users, search.joins)
search.conditions.users.orders.id_gt = 2
search.conditions.reset_users!
- assert_equal nil, search.auto_joins
+ assert_equal nil, search.joins
end
-=end
+
def test_limit
search = Account.new_search
search.limit = 10
Please sign in to comment.
Something went wrong with that request. Please try again.