Displaying 1 result from an estimated 1 matches for "pref_date_time_format".
2012 Apr 17
6
ActiveRecord with different Date/Time format
...datetime
Here is a snippet of the controller
class ArticlesController < ApplicationController
before_filter :format_date_time, :only => [:create, :update]
...
...
private
def format_date_time
datetime = params[:datetime]
params[:datetime] = DateTime.strptime(datetime,
pref_date_time_format).strftime(''%c'')
end
end
Would anyone please verify if it is right approach or not? Also I would
appreciate someone outlines better ways to accomplish this.
Thanks,
Amit Patel
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribe...