-
Notifications
You must be signed in to change notification settings - Fork 553
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
still polymorphic if modifying devise.rb (configuration & migrations) #828
Comments
Setting is not used for migration in generator, it's only used to define association in the model: In this line set class_name or polymorphic options for belongs_to: But migration template has no check on that setting, neither invited_by_foreign_key or invited_by_counter_cache settings: You can change migration template to check that setting, or other related settings too, and send pull request. However those settings can be changed per model, as devise readme explains, if invited_by_class_name is set for one model only, generated migration must be changed. |
Hello,
From what I read in what's inserted in initializers/devise.rb after running
If I were to modify this:
and uncomment the
config.invited_by_class_name = 'User'
line, I expected for theinvited_by
not to be polymorphic, since it says it will be polymorphic if it isnil
, suggesting that it wouldn't be polymorphic if it wasn't nil.To clarify, now that devise.rb block is
As I read in the README, I manually changed my models/user.rb file and added the following line:
Later I ran
It annotated the models/user.rb file and also created a migration file (devise_invitable_add_to_users).
I expected it to have this
or something like that, but instead it had this:
I manually edited the migration file and the migration worked as I expected, but from what the devise.rb file says I expected for that migration to be created with the foreign_key to the config.invited_by_class_name. If not, what's it for?
Am I wrong to have expected that behaviour?
The text was updated successfully, but these errors were encountered: