Skip to content
This repository has been archived by the owner on Feb 7, 2018. It is now read-only.

Validation helpers via errors object #52

Open
2 tasks
marten opened this issue Aug 12, 2013 · 1 comment
Open
2 tasks

Validation helpers via errors object #52

marten opened this issue Aug 12, 2013 · 1 comment
Milestone

Comments

@marten
Copy link
Contributor

marten commented Aug 12, 2013

The actual API is also up for debate, so feel free to have better ideas than just using ActiveModel::Errors. The new README proposes:

  def validate
    errors.add(:id, "can't contain spaces") if id.include?(" ")
  end
  • This needs to be implemented.
  • Remove the old validations module from alpha_compat?
@markijbema
Copy link
Member

I like this, especially since we could actually make the validations compatible:

    def validate_integer_string param_name, param
      return if param.is_a?(String) && /\A\d+\Z/.match(param)

      errors.add param_name.to_s,  "should be an integer string."
    end

That way we could decouple this functionality introduction from removing calls to validation helpers, allowing us to first upgrade, and then one by one remove old validations.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants