Skip to content

Commit c43b540

Browse files
authored
Merge pull request rails#52766 from p8/activerecord/join-table-examples
Document more examples of create_join_table naming results
2 parents df4386a + 54b09a5 commit c43b540

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,15 @@ def build_create_table_definition(table_name, id: :primary_key, primary_key: nil
345345
# # Creates a table called 'assemblies_parts' with no id.
346346
# create_join_table(:assemblies, :parts)
347347
#
348+
# # Creates a table called 'paper_boxes_papers' with no id.
349+
# create_join_table('papers', 'paper_boxes')
350+
#
351+
# A duplicate prefix is combined into a single prefix. This is useful for
352+
# namespaced models like Music::Artist and Music::Record:
353+
#
354+
# # Creates a table called 'music_artists_records' with no id.
355+
# create_join_table('music_artists', 'music_records')
356+
#
348357
# You can pass an +options+ hash which can include the following keys:
349358
# [<tt>:table_name</tt>]
350359
# Sets the table name, overriding the default.

0 commit comments

Comments
 (0)