diff options
author | Nick Kallen <nkallen@nick-kallens-computer-2.local> | 2008-03-16 16:14:02 -0700 |
---|---|---|
committer | Nick Kallen <nkallen@nick-kallens-computer-2.local> | 2008-03-16 16:14:02 -0700 |
commit | af3d7c5193eee90ad17b1ba8aaf5d76a2874c0a5 (patch) | |
tree | c3eaf1cfdc0ed1f1d977937fb04848566e964c32 /lib/active_relation/extensions | |
parent | ed9c8d4d828fe4e28c1e37ed8921acbee54450f2 (diff) | |
download | rails-af3d7c5193eee90ad17b1ba8aaf5d76a2874c0a5.tar.gz rails-af3d7c5193eee90ad17b1ba8aaf5d76a2874c0a5.tar.bz2 rails-af3d7c5193eee90ad17b1ba8aaf5d76a2874c0a5.zip |
formatting insert and update statements
- values need to be coerced to the type corresponding to the column
Diffstat (limited to 'lib/active_relation/extensions')
-rw-r--r-- | lib/active_relation/extensions/array.rb | 4 | ||||
-rw-r--r-- | lib/active_relation/extensions/hash.rb | 8 |
2 files changed, 2 insertions, 10 deletions
diff --git a/lib/active_relation/extensions/array.rb b/lib/active_relation/extensions/array.rb index 5e2981a4c5..c07819d35f 100644 --- a/lib/active_relation/extensions/array.rb +++ b/lib/active_relation/extensions/array.rb @@ -3,7 +3,7 @@ class Array Hash[*flatten] end - def to_sql(formatter = Sql::SelectExpression.new) - formatter.array self + def to_sql(formatter = nil) + "(" + collect { |e| e.to_sql(formatter) }.join(', ') + ")" end end
\ No newline at end of file diff --git a/lib/active_relation/extensions/hash.rb b/lib/active_relation/extensions/hash.rb index 133eab1026..a33ace5738 100644 --- a/lib/active_relation/extensions/hash.rb +++ b/lib/active_relation/extensions/hash.rb @@ -8,12 +8,4 @@ class Hash descendent.merge(yield(key) => yield(value)) end end - - def to_sql(formatter = nil) - '(' + - inject([]) do |values, (key, value)| - values << key.format(value) - end.join(', ') + - ')' - end end
\ No newline at end of file |