Fix missing_presence_validation for polymorphic associations#164
Fix missing_presence_validation for polymorphic associations#164fatkodima wants to merge 1 commit into
missing_presence_validation for polymorphic associations#164Conversation
|
This doesn't look right. See the discussion on the corresponding issue. |
| Context.create_table(:images) do |t| | ||
| t.references :imageable, null: false, polymorphic: true | ||
| end.define_model do | ||
| belongs_to :imageable, polymorphic: true, required: true |
There was a problem hiding this comment.
Required is deprecated in newer versions of Rails. Let's add a conditional here and pass required for older versions use optional for newer versions.
Additionally, we should be testing for all combinations:
- Columns are required, association is required (with covered this already)
- Columns are required, association is optional.
- Columns are optional, association is required.
- Columns are optional, association is optional.
There was a problem hiding this comment.
Deprecation was introduced in rails/rails@6576f73
Pushed more tests.
Better to have a message mentioning to add :optional/:required to the association, but it requires too many changes to the checker. Maybe this is good enough to mention just columns?
There was a problem hiding this comment.
Do you think we can proceed with this fix guys?
b816e91 to
a6a07ee
Compare
afcda83 to
4ee897c
Compare
|
I'm closing this in favor of #230 which adds support for associations. |
Fixes #163.