Skip to content
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

Yet another method implementation #1

Open
toshimaru opened this issue Sep 6, 2017 · 0 comments
Open

Yet another method implementation #1

toshimaru opened this issue Sep 6, 2017 · 0 comments

Comments

@toshimaru
Copy link
Owner

def valid_attributes?(*attr_names, **options)
  self.class.validators_on(*attr_names).zip(attr_names) do |validator, attribute|
    validator.validate_each(self, attribute, send(attribute))
  end
  errors.empty?
end

Issue

Because the behavior is different from the existing implementation. In particular, the existing treats blank string as nil, but the other not.

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

No branches or pull requests

1 participant