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

Rails 3 Validation fails for attr_accessors when using SimpleRecord #26

Open
JoshMcKin opened this issue Mar 27, 2011 · 0 comments
Open

Comments

@JoshMcKin
Copy link

Sorry for the delay in making this ticket, been swamped.

Issue: attr_accessor it gives bogus errors

class Foo < SimpleRecord::Base

has_strings :password

attr_accessor :new_password

For this example new_passwords must be formated like emails

validates_format_of :new_password, :with => /^[-a-z0-9_+.]+@([-a-
z0-9]+.)+[a-z0-9]{2,4}$/i

Stuff for encrypting and setting password...

end

bar = Foo.new
bar.new_password = [email protected]
bar.valid? #=> false
bar.errors #=> {:new_password=>["is invalid"]}

Thanks,
Josh

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