[feature] rails generator options for foreign keys

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[feature] rails generator options for foreign keys

Matt Walston
Anyone else see a legitimate use case for allowing passing of foreign key options through a generator?  For example

$ rails g model invoice billing_address:references{table:addresses}

would generate a migration like following:
class CreateInvoices < ActiveRecord::Migration[5.2]
def change
:invoices do |t|
.references :billing_address, foreign_key: { to_table: :addresses }


Frankly I'm unsure if benefits are worth effort, but I'll work on this if others see value.

You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.