-
-
Notifications
You must be signed in to change notification settings - Fork 134
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
Remove NonNilColumnDefault exception from ranked-model.rb #181
base: master
Are you sure you want to change the base?
Conversation
Raising the NonNilColumnDefault exception causes the Rails app to not even boot. Allow users to react to this requirement without crashing their application after adding the gem.
Hi @vanboom, what does Perhaps we could improve the error raised? |
The logger message simply prints out the requirement but does not cause an exception. Thanks for considering this change. The reason we suggested it was that we added ranked-model to our Gemfile, then the app crashed with the exception because our rank column had a default value. We are adding The NonNilColumnDefault exception requires that the database migration be released to production (to correct the default value requirement) prior to the gem being added to the application (because adding the gem renders So our suggestion would be to print a warning similar to the way gems print deprecation warnings without raising a formal exception. That would allow developers to recognize the warning message, develop on a branch that includes the migration, then make one merge to |
Thanks @vanboom. Good points. Let's continue the discussion on the issue thread for now until we come to an agreement :) |
Closing this since we couldn't come to an agreement. I don't think it's too unreasonable to expect the database conditions to be correct when the ranking is declared on boot. Perhaps the workaround would have been to create a new column for the ranking and then rebuild the list based on the old gem's ordering, then remove that column. There were just a lot of issues where users were setting a default on the column, so this avoided all that pain for me. |
Thanks for reviewing this. Imho, having the exception block the |
Fair enough. We just need to figure out how to detect the CLI environment vs a running app. I definitely don't want the app to boot if there's a default column value. |
Turns out the check is in a middleware: |
For your consideration...
Raising the NonNilColumnDefault exception causes the Rails app to not even boot. Allow users to react to this requirement without crashing their application after adding the gem.