-
-
Save paulsonkoly/e57b3e9c98e0aa7180b6c32fc61c9938 to your computer and use it in GitHub Desktop.
validator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'active_support' | |
require 'active_model' | |
class Form | |
include ActiveModel::Validations | |
include ActiveModel::Attributes | |
attribute :blah | |
validates :blah, numericality: true | |
end | |
f = Form.new | |
f.blah = 'a' | |
f.valid? # => false | |
f._validators[:blah].object_id # => 47297490130120 | |
f2 = Form.new | |
f2._validators[:blah].object_id # => 47297490130120 | |
Form._validators[:blah].object_id # => 47297490130120 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment