fake_arel 0.9.3 → 0.9.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,7 +6,7 @@ require 'bundler/version'
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "fake_arel"
9
- s.version = "0.9.3"
9
+ s.version = "0.9.4"
10
10
  s.platform = Gem::Platform::RUBY
11
11
  s.author = "Grant Ammons"
12
12
  s.email = ["grant@pipelinedealsco.com"]
@@ -9,7 +9,7 @@ require 'fake_arel/rails_3_finders'
9
9
  require 'fake_arel/calculations'
10
10
 
11
11
  module FakeArel
12
- VERSION = '0.9.3'
12
+ VERSION = '0.9.4'
13
13
  ActiveRecord::Base.send :include, Rails3Finders
14
14
  ActiveRecord::Base.send :include, WithScopeReplacement
15
15
  end
@@ -45,7 +45,8 @@ module Rails3Finders
45
45
  begin
46
46
  where << merge_conditions(s[:conditions])
47
47
  rescue NoMethodError
48
- where << scopes[0].first.class.merge_conditions(s[:conditions])
48
+ # I am ActiveRecord::Base. Only my subclasses define merge_conditions:
49
+ where << subclasses.first.merge_conditions(s[:conditions])
49
50
  end
50
51
  #where << merge_conditions(s[:conditions])
51
52
  joins << s[:joins] unless s[:joins].nil?
@@ -174,6 +174,12 @@ describe "Fake Arel" do
174
174
  # an example using joins, as well as a query that returns nothing
175
175
  Reply.or(Reply.recent_joins_topic, Reply.topic_title_is("Nothin")).all.map(&:id).should == [5]
176
176
  end
177
+
178
+ it 'should be able to combine with "or", an empty named scope with another non-empty one' do
179
+ q1 = Reply.where(:id => 0)
180
+ q2 = Reply.where(:id => 2)
181
+ Reply.or(q1,q2).all.map(&:id).should == [2]
182
+ end
177
183
 
178
184
  it "should use select like rails 3 uses select" do
179
185
  lambda { Reply.all.select {|r| r.id == 1 }}.should_not raise_error
Binary file
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fake_arel
3
3
  version: !ruby/object:Gem::Version
4
- hash: 61
4
+ hash: 51
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 3
10
- version: 0.9.3
9
+ - 4
10
+ version: 0.9.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Grant Ammons
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-12-10 00:00:00 -05:00
18
+ date: 2011-03-21 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency