-
Notifications
You must be signed in to change notification settings - Fork 159
Description
When running bin/rails g statesman:active_record_transition DirectDebitMandate DirectDebitMandateTransition (yes, I'm making a model to hold a DD mandate using Statesman - very meta), the DirectDebitMandate model file already exists, but the DirectDebitMandateTransition one is due to be created.
However, the in the migration that creates the table (which happens before the model file is created), there is this line which requires the model file to already exist.
My proposal would be to switch the order of the migration and model template lines in the generator file so that the file does exist when the migration is being created.
EDIT: A quick test of this suggests that the class isn't loaded in so the migration still fails to generate.
EDIT 2: Is there a reason why https://github.com/gocardless/statesman/blob/master/lib/statesman/adapters/active_record.rb#L10 doesn't just use ApplicationRecord.connection.respond_to?(:supports_partial_index?) rather than going from the model?