aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorNick Kallen <nkallen@nick-kallens-computer-2.local>2008-02-16 16:37:00 -0800
committerNick Kallen <nkallen@nick-kallens-computer-2.local>2008-02-16 16:37:00 -0800
commitd0ba361c93aa94865ccfe739e9ab65654771e38e (patch)
tree56ac5623fd0b77eeb9642ed752e31d2f5f08cc9c /lib
parent28b11fdf4d4e5cd4b98d6c79fc88999a41532103 (diff)
downloadrails-d0ba361c93aa94865ccfe739e9ab65654771e38e.tar.gz
rails-d0ba361c93aa94865ccfe739e9ab65654771e38e.tar.bz2
rails-d0ba361c93aa94865ccfe739e9ab65654771e38e.zip
more test coverage
Diffstat (limited to 'lib')
-rw-r--r--lib/active_relation/relations/join.rb10
-rw-r--r--lib/active_relation/relations/projection.rb7
-rw-r--r--lib/active_relation/relations/relation.rb2
3 files changed, 10 insertions, 9 deletions
diff --git a/lib/active_relation/relations/join.rb b/lib/active_relation/relations/join.rb
index ede8b272cb..4c4f2e66a2 100644
--- a/lib/active_relation/relations/join.rb
+++ b/lib/active_relation/relations/join.rb
@@ -7,12 +7,10 @@ module ActiveRelation
end
def ==(other)
- self.class == other.class and
- predicates == other.predicates and (
- (relation1 == other.relation1 and
- relation2 == other.relation2) or
- (relation2 == other.relation1 and
- relation1 == other.relation2)
+ self.class == other.class and
+ predicates == other.predicates and (
+ (relation1 == other.relation1 and relation2 == other.relation2) or
+ (relation2 == other.relation1 and relation1 == other.relation2)
)
end
diff --git a/lib/active_relation/relations/projection.rb b/lib/active_relation/relations/projection.rb
index 9e0725f6c5..d0c68869bd 100644
--- a/lib/active_relation/relations/projection.rb
+++ b/lib/active_relation/relations/projection.rb
@@ -1,14 +1,17 @@
module ActiveRelation
class Projection < Compound
attr_reader :projections
- alias_method :attributes, :projections
def initialize(relation, *projections)
@relation, @projections = relation, projections
end
+ def attributes
+ projections.collect { |p| p.bind(self) }
+ end
+
def ==(other)
- self.class == other.class and
+ self.class == other.class and
relation == other.relation and
projections == other.projections
end
diff --git a/lib/active_relation/relations/relation.rb b/lib/active_relation/relations/relation.rb
index c5409bc9ff..c65120a75c 100644
--- a/lib/active_relation/relations/relation.rb
+++ b/lib/active_relation/relations/relation.rb
@@ -109,7 +109,7 @@ module ActiveRelation
end
def attribute_for_name(name)
- attributes.detect { |a| a.alias_or_name == name }
+ attributes.detect { |a| a.alias_or_name.to_s == name.to_s }
end
def attribute_for_attribute(attribute)