You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi guys, I am on Rails 4 (and ruby 2.0.0p195) and I had a curious experience.
I tried many ways to check date validity in my model.
For me, the better way to do it is using regex. My form (client side) just accepts date in this format 'dd/mm/yyyy', and in my table migration I have a date type field (my db is postgres).
My date always was returning as invalid, so I checked that Rails was converting it to psql date format ('yyyy-mm-dd') before to perform regex match.
Hi guys, I am on Rails 4 (and ruby 2.0.0p195) and I had a curious experience.
I tried many ways to check date validity in my model.
For me, the better way to do it is using regex. My form (client side) just accepts date in this format 'dd/mm/yyyy', and in my table migration I have a date type field (my db is postgres).
My date always was returning as invalid, so I checked that Rails was converting it to psql date format ('yyyy-mm-dd') before to perform regex match.
Weird that the same code works in Rails 3.
See the gist: https://gist.github.com/glaucocustodio/6039161
Note: as well as in Rails 3 project, in my Rails 4 app I have a locales/pt-BR.yml and language set to it in application.rb.
If it is my own mistake, please, how I must to proceed?
Thank you.
The text was updated successfully, but these errors were encountered: