diff options
author | Nick Kallen <nkallen@nick-kallens-computer-2.local> | 2008-01-11 00:05:22 -0800 |
---|---|---|
committer | Nick Kallen <nkallen@nick-kallens-computer-2.local> | 2008-01-11 00:05:22 -0800 |
commit | d9f200f2fb14907137a27d5c9522575274bb0cde (patch) | |
tree | 52238fbcf14067af92af41c52c3477647bc4049b | |
parent | 49c251eded06fe028949624f1e0c4dd7748c7925 (diff) | |
download | rails-d9f200f2fb14907137a27d5c9522575274bb0cde.tar.gz rails-d9f200f2fb14907137a27d5c9522575274bb0cde.tar.bz2 rails-d9f200f2fb14907137a27d5c9522575274bb0cde.zip |
minor cleanup
- using a struct, a bit more terse
-rw-r--r-- | lib/active_relation/relations/base.rb | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/lib/active_relation/relations/base.rb b/lib/active_relation/relations/base.rb index c4a887eecd..67a64b9aa6 100644 --- a/lib/active_relation/relations/base.rb +++ b/lib/active_relation/relations/base.rb @@ -38,8 +38,8 @@ module ActiveRelation Predicates::RelationInclusion.new(attribute, self) end - def select(*s) - Selection.new(self, *s) + def select(*predicates) + Selection.new(self, *predicates) end def project(*attributes) @@ -62,21 +62,10 @@ module ActiveRelation Deletion.new(self) end - class JoinOperation - attr_reader :join_sql, :relation1, :relation2 - - def initialize(join_sql, relation1, relation2) - @join_sql, @relation1, @relation2 = join_sql, relation1, relation2 - end - + JoinOperation = Struct.new(:join_sql, :relation1, :relation2) do def on(*predicates) Join.new(join_sql, relation1, relation2, *predicates) end - - def ==(other) - (relation1 == other.relation1 and relation2 == other.relation2) or - (relation1 == other.relation2 and relation2 == other.relation1) - end end end include Operations |