I am parsing some data and then trying to save it into a database within Rails.
I parsed some text into a string “23/May/2012” and my goal now is to figure out how to turn that string into a date that I can save to the database via ActiveRecord.
Would the approach to this be different if I am using straight Ruby in IRB vs. trying to store it in a Rails DB?
Try this:
This assumes your
datecolumn is aDatetype. ForDateTimeuseDateTime.parseandTime.parseforTime.This should work in both your app and IRB.