Skip to content
This repository was archived by the owner on Apr 17, 2018. It is now read-only.
This repository was archived by the owner on Apr 17, 2018. It is now read-only.

including ActiveModel::Validations breaks DataMapper validations #4

Description

@tillsc

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions