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

Simple question about creating a record #83

Closed
davidtlee opened this issue Mar 26, 2015 · 2 comments
Closed

Simple question about creating a record #83

davidtlee opened this issue Mar 26, 2015 · 2 comments

Comments

@davidtlee
Copy link

Assuming I follow the README, am I supposed to be able open the rails console (rails c) and execute

User.first.update_attribute :phone_number, '<some phone string>'

and phony_rails will automatically normalize the string and save it into the table?

I seem to be missing something because no normalization is happening. Moreover, if I give it a clearly wrong phone number, e.g. User.first.update_attribute :phone_number, '1111', the commit is still successful.

In app/models/user.rb, I have:

  phony_normalize :phone_number, :default_country_code => 'US'
  validates :phone_number, phony_plausible: true

Thanks!

@joost
Copy link
Owner

joost commented Mar 26, 2015

u = User.first
u.phone_number = '1111'
u.save # gets normalized

@joost joost closed this as completed Mar 26, 2015
@davidtlee
Copy link
Author

Ahhh, thanks @joost!

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

2 participants