diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2016-01-16 04:18:21 -0200 |
---|---|---|
committer | Rafael França <rafaelmfranca@gmail.com> | 2016-01-16 04:18:21 -0200 |
commit | de2259791cd21e80d44ec7c7562324c73ff85699 (patch) | |
tree | 06769112a75a6e063147575d4b3e3f29cf3e9753 /activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb | |
parent | cff9cd9fe754ed8d8b7d6656f5d3a5a26f00f216 (diff) | |
parent | 744552f72d49c222d6cc42ab8bad9a16a812377a (diff) | |
download | rails-de2259791cd21e80d44ec7c7562324c73ff85699.tar.gz rails-de2259791cd21e80d44ec7c7562324c73ff85699.tar.bz2 rails-de2259791cd21e80d44ec7c7562324c73ff85699.zip |
Merge pull request #20005 from kamipo/default_expression_support
Add `:expression` option support on the schema default
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb b/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb index d5879ea7df..c1c77a967e 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb @@ -55,10 +55,11 @@ module ActiveRecord end end - # Does not quote function default values for UUID columns - def quote_default_expression(value, column) #:nodoc: - if column.type == :uuid && value =~ /\(\)/ - value + def quote_default_expression(value, column) # :nodoc: + if value.is_a?(Proc) + value.call + elsif column.type == :uuid && value =~ /\(\)/ + value # Does not quote function default values for UUID columns elsif column.respond_to?(:array?) value = type_cast_from_column(column, value) quote(value) |