aboutsummaryrefslogtreecommitdiffstats
path: root/lib/active_relation/extensions
diff options
context:
space:
mode:
authorNick Kallen <nkallen@nick-kallens-computer-2.local>2008-01-13 18:31:35 -0800
committerNick Kallen <nkallen@nick-kallens-computer-2.local>2008-01-13 18:31:35 -0800
commitbc4f6b8a29fc96c05efe0304ce7fad075818d2a2 (patch)
tree75f1b67bddf5ce5e247f57c5f9d8f8bde05c1f51 /lib/active_relation/extensions
parent2e63ac91302e2df397a286fdaf9cea51635071a6 (diff)
downloadrails-bc4f6b8a29fc96c05efe0304ce7fad075818d2a2.tar.gz
rails-bc4f6b8a29fc96c05efe0304ce7fad075818d2a2.tar.bz2
rails-bc4f6b8a29fc96c05efe0304ce7fad075818d2a2.zip
experimenting with strategy pattern rather than conditional; not as terse, nor transparent, but i still feel it's better
Diffstat (limited to 'lib/active_relation/extensions')
-rw-r--r--lib/active_relation/extensions/hash.rb2
-rw-r--r--lib/active_relation/extensions/object.rb7
2 files changed, 3 insertions, 6 deletions
diff --git a/lib/active_relation/extensions/hash.rb b/lib/active_relation/extensions/hash.rb
index d9496df2e9..50864912bf 100644
--- a/lib/active_relation/extensions/hash.rb
+++ b/lib/active_relation/extensions/hash.rb
@@ -5,7 +5,7 @@ class Hash
end
end
- def to_sql(options = {})
+ def to_sql(strategy = nil)
"(#{values.collect(&:to_sql).join(', ')})"
end
end \ No newline at end of file
diff --git a/lib/active_relation/extensions/object.rb b/lib/active_relation/extensions/object.rb
index ea582d1ca1..2d43120f70 100644
--- a/lib/active_relation/extensions/object.rb
+++ b/lib/active_relation/extensions/object.rb
@@ -1,12 +1,9 @@
class Object
- include ActiveRelation::SqlBuilder
-
def qualify
self
end
- def to_sql(options = {})
- options.reverse_merge!(:quote => true)
- options[:quote] ? quote(self) : self
+ def to_sql(strategy = ActiveRelation::Sql::Scalar.new)
+ strategy.scalar self
end
end \ No newline at end of file