File tree Expand file tree Collapse file tree 2 files changed +6
-0
lines changed
lib/active_record/connection_adapters/postgresql Expand file tree Collapse file tree 2 files changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -299,6 +299,8 @@ def client_min_messages=(level)
299
299
300
300
# Returns the sequence name for a table's primary key or some other specified key.
301
301
def default_sequence_name ( table_name , pk = "id" ) # :nodoc:
302
+ return nil if pk . is_a? ( Array )
303
+
302
304
result = serial_sequence ( table_name , pk )
303
305
return nil unless result
304
306
Utils . extract_schema_qualified_name ( result ) . to_s
Original file line number Diff line number Diff line change @@ -1343,6 +1343,10 @@ def test_sequence_name_with_abstract_class
1343
1343
assert_equal k . reset_sequence_name , orig_name
1344
1344
end
1345
1345
1346
+ def test_sequence_name_for_cpk_model
1347
+ assert_nil Cpk ::Book . sequence_name
1348
+ end
1349
+
1346
1350
def test_count_with_join
1347
1351
res = Post . count_by_sql "SELECT COUNT(*) FROM posts LEFT JOIN comments ON posts.id=comments.post_id WHERE posts.#{ QUOTED_TYPE } = 'Post'"
1348
1352
res2 = Post . where ( "posts.#{ QUOTED_TYPE } = 'Post'" ) . joins ( "LEFT JOIN comments ON posts.id=comments.post_id" ) . count
You can’t perform that action at this time.
0 commit comments