searchlogic 2.3.7 → 2.3.8

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -13,6 +13,7 @@ begin
13
13
  gem.rubyforge_project = "searchlogic"
14
14
  gem.add_dependency "activerecord", ">= 2.0.0"
15
15
  end
16
+ Jeweler::GemcutterTasks.new
16
17
  Jeweler::RubyforgeTasks.new
17
18
  rescue LoadError
18
19
  puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
data/VERSION.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :minor: 3
3
- :patch: 7
3
+ :patch: 8
4
4
  :major: 2
5
5
  :build:
@@ -72,7 +72,8 @@ module Searchlogic
72
72
  end
73
73
 
74
74
  def boolean_condition?(name)
75
- columns_hash.key?(name.to_s) && columns_hash[name.to_s].type == :boolean
75
+ column = columns_hash[name.to_s] || columns_hash[name.to_s.gsub(/^not_/, "")]
76
+ column && column.type == :boolean
76
77
  end
77
78
 
78
79
  def method_missing(name, *args, &block)
@@ -80,7 +81,8 @@ module Searchlogic
80
81
  create_condition(details[:column], details[:condition], args)
81
82
  send(name, *args)
82
83
  elsif boolean_condition?(name)
83
- named_scope name, :conditions => {name => true}
84
+ column = name.to_s.gsub(/^not_/, "")
85
+ named_scope name, :conditions => {column => (name.to_s =~ /^not_/).nil?}
84
86
  send(name)
85
87
  else
86
88
  super
data/searchlogic.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{searchlogic}
8
- s.version = "2.3.7"
8
+ s.version = "2.3.8"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ben Johnson of Binary Logic"]
@@ -19,12 +19,6 @@ describe "Conditions" do
19
19
  User.age_equals([5, 7]).all.should == User.find_all_by_age([5, 7])
20
20
  end
21
21
 
22
- it "should have equals for boolean columns" do
23
- female = User.create(:male => false)
24
- male = User.create(:male => true)
25
- User.male.should == [male]
26
- end
27
-
28
22
  it "should have does not equal" do
29
23
  (5..7).each { |age| User.create(:age => age) }
30
24
  User.age_does_not_equal(6).all.should == User.find_all_by_age([5,7])
@@ -84,6 +78,13 @@ describe "Conditions" do
84
78
  end
85
79
 
86
80
  context "boolean conditions" do
81
+ it "should have scopes for boolean columns" do
82
+ female = User.create(:male => false)
83
+ male = User.create(:male => true)
84
+ User.male.all.should == [male]
85
+ User.not_male.all.should == [female]
86
+ end
87
+
87
88
  it "should have null" do
88
89
  ["bjohnson", nil].each { |username| User.create(:username => username) }
89
90
  User.username_null.all.should == User.find_all_by_username(nil)
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: 2.3.7
4
+ version: 2.3.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Johnson of Binary Logic