activerecord 3.0.2 → 3.0.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of activerecord might be problematic. Click here for more details.

data/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+ *Rails 3.0.3 (November 16, 2010)*
2
+
3
+ * Support find by class like this: Post.where(:name => Post)
4
+
5
+
1
6
  *Rails 3.0.2 (November 15, 2010)*
2
7
 
3
8
  * Dramatic speed increase (see: http://engineering.attinteractive.com/2010/10/arel-two-point-ohhhhh-yaaaaaa/) [Aaron Patterson]
@@ -1607,12 +1607,20 @@ MSG
1607
1607
  self.class.columns_hash[name.to_s]
1608
1608
  end
1609
1609
 
1610
- # Returns true if the +comparison_object+ is the same object, or is of the same type and has the same id.
1610
+ # Returns true if +comparison_object+ is the same exact object, or +comparison_object+
1611
+ # is of the same type and +self+ has an ID and it is equal to +comparison_object.id+.
1612
+ #
1613
+ # Note that new records are different from any other record by definition, unless the
1614
+ # other record is the receiver itself. Besides, if you fetch existing records with
1615
+ # +select+ and leave the ID out, you're on your own, this predicate will return false.
1616
+ #
1617
+ # Note also that destroying a record preserves its ID in the model instance, so deleted
1618
+ # models are still comparable.
1611
1619
  def ==(comparison_object)
1612
1620
  comparison_object.equal?(self) ||
1613
- persisted? &&
1614
- (comparison_object.instance_of?(self.class) &&
1615
- comparison_object.id == id)
1621
+ comparison_object.instance_of?(self.class) &&
1622
+ id.present? &&
1623
+ comparison_object.id == id
1616
1624
  end
1617
1625
 
1618
1626
  # Delegates to ==
@@ -30,6 +30,11 @@ module ActiveRecord
30
30
  attribute.in(values)
31
31
  when Range, Arel::Relation
32
32
  attribute.in(value)
33
+ when ActiveRecord::Base
34
+ attribute.eq(value.quoted_id)
35
+ when Class
36
+ # FIXME: I think we need to deprecate this behavior
37
+ attribute.eq(value.name)
33
38
  else
34
39
  attribute.eq(value)
35
40
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 1
5
5
  prerelease: false
6
6
  segments:
7
7
  - 3
8
8
  - 0
9
- - 2
10
- version: 3.0.2
9
+ - 3
10
+ version: 3.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - David Heinemeier Hansson
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-15 00:00:00 -06:00
18
+ date: 2010-11-16 00:00:00 -06:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -26,12 +26,12 @@ dependencies:
26
26
  requirements:
27
27
  - - "="
28
28
  - !ruby/object:Gem::Version
29
- hash: 3
29
+ hash: 1
30
30
  segments:
31
31
  - 3
32
32
  - 0
33
- - 2
34
- version: 3.0.2
33
+ - 3
34
+ version: 3.0.3
35
35
  type: :runtime
36
36
  version_requirements: *id001
37
37
  - !ruby/object:Gem::Dependency
@@ -42,12 +42,12 @@ dependencies:
42
42
  requirements:
43
43
  - - "="
44
44
  - !ruby/object:Gem::Version
45
- hash: 3
45
+ hash: 1
46
46
  segments:
47
47
  - 3
48
48
  - 0
49
- - 2
50
- version: 3.0.2
49
+ - 3
50
+ version: 3.0.3
51
51
  type: :runtime
52
52
  version_requirements: *id002
53
53
  - !ruby/object:Gem::Dependency