Similarly, you can get the Object time from a string as follows:
t = Time.parse "9:00 PM" => 2013-12-24 21:00:00 +0530 t = Time.parse "12:00 AM" => 2013-12-24 00:00:00 +0530
But Ruby parsed it like Date!
This way you can use the column as a row.
add_column :table_name, :from, :string, :limit => 8, :default => "00:00 AM", :null => false add_column :table_name, :to, :string, :limit => 8, :default => "00:00 AM", :null => false
And you can assign a string object to an attribute,
r.from = "05:30 PM" r.save
And parse the string to get a time object,
Time.zone.parse("02:00 PM")
Abhi Dec 24 '13 at 12:16 2013-12-24 12:16
source share