diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-05-18 15:57:28 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-05-18 15:57:28 -0300 |
commit | fc628f7ad8fed642167297e0d50a1cad7e3da831 (patch) | |
tree | 6d1daad9ae6b18f4e1d769f319e06dd78b730c09 /activerecord/lib/active_record | |
parent | 0cae22d2ec42512bc496a2a344adc912ab9110d7 (diff) | |
parent | 684caf55038234374a17c1e010e8b18d2dc0c90f (diff) | |
download | rails-fc628f7ad8fed642167297e0d50a1cad7e3da831.tar.gz rails-fc628f7ad8fed642167297e0d50a1cad7e3da831.tar.bz2 rails-fc628f7ad8fed642167297e0d50a1cad7e3da831.zip |
Merge pull request #20190 from kamipo/fix_serial_with_quoted_sequence_name
Fix `serial?` with quoted sequence name
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql/column.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/column.rb b/activerecord/lib/active_record/connection_adapters/postgresql/column.rb index be13ead120..bfa03fa136 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/column.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/column.rb @@ -8,7 +8,8 @@ module ActiveRecord def serial? return unless default_function - %r{\Anextval\('(?<table_name>.+)_#{name}_seq'::regclass\)\z} === default_function + table_name = @table_name || '(?<table_name>.+)' + %r{\Anextval\('"?#{table_name}_#{name}_seq"?'::regclass\)\z} === default_function end end end |