You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 17, 2018. It is now read-only.
If a DataMapper model includes ActiveModel::Validations ActiveModel's implementation will override DataMapper's. This could happen for example by using ActiveModel::SecurePassword and has_secure_password for example when not disabling the included Validations with has_secure_password(:validations => false).
I'm not sure how it could be possible to implement a ActiveModel agnostic dm-validations when both dm-validations and ActiveModel are claiming the errors method for themselves.
Perhaps this gem could include ActiveModel::Validations in every DataMapper::Resource (causing .errors to return ActiveModel::Errors). The nice effect: You could use ActiveModel validators in your DataMapper model. The problem: AFAICS this would disable all DataMapper validations. I don't know if there is an elegant solution to delegate the error retrieval back to DataMapper.
The text was updated successfully, but these errors were encountered:
Now that ActiveModel Validations exist in their current state, I have used them over dm validations in a number of cases. I generally think it wiser to choose one method over the other. In the case of using other AM functionality, that choice seems to be made for you :-/.
My 2 cents is that the code in DM validations might need to be pretty gnarly to dance around AM, when they're both trying to provide much of the same functionality. As you said errors is a huge conflict.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
If a DataMapper model includes
ActiveModel::Validations
ActiveModel's implementation will override DataMapper's. This could happen for example by usingActiveModel::SecurePassword
andhas_secure_password
for example when not disabling the included Validations withhas_secure_password(:validations => false)
.I'm not sure how it could be possible to implement a ActiveModel agnostic dm-validations when both dm-validations and ActiveModel are claiming the
errors
method for themselves.Perhaps this gem could
include ActiveModel::Validations
in every DataMapper::Resource (causing.errors
to returnActiveModel::Errors
). The nice effect: You could use ActiveModel validators in your DataMapper model. The problem: AFAICS this would disable all DataMapper validations. I don't know if there is an elegant solution to delegate the error retrieval back to DataMapper.The text was updated successfully, but these errors were encountered: