chronological 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
@@ -11,6 +11,25 @@ module Chronological
|
|
11
11
|
start_date_field = ['started_on', time_field_utc_suffix].compact.join('_')
|
12
12
|
end_date_field = ['ended_on', time_field_utc_suffix].compact.join('_')
|
13
13
|
|
14
|
+
class_eval do
|
15
|
+
columns_hash[start_time_field] = ActiveRecord::ConnectionAdapters::Column.new(start_time_field, nil, "datetime")
|
16
|
+
columns_hash[end_time_field] = ActiveRecord::ConnectionAdapters::Column.new(end_time_field, nil, "datetime")
|
17
|
+
end
|
18
|
+
|
19
|
+
unless base_time_field_is_utc
|
20
|
+
define_method("#{start_time_field}_utc") do
|
21
|
+
return nil unless send(start_time_field).present?
|
22
|
+
|
23
|
+
send(start_time_field).in_time_zone('UTC')
|
24
|
+
end
|
25
|
+
|
26
|
+
define_method("#{end_time_field}_utc") do
|
27
|
+
return nil unless send(end_time_field).present?
|
28
|
+
|
29
|
+
send(end_time_field).in_time_zone('UTC')
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
14
33
|
define_method(start_time_field) do
|
15
34
|
return nil unless send(base_time_field).present? && send(options[:start]).present?
|
16
35
|
|