Sha256: 65d4b77960ca57b149adeb0af42a5e910df54872b8eebf4ac41d4348c667c04d
Contents?: true
Size: 941 Bytes
Versions: 48
Compression:
Stored size: 941 Bytes
Contents
require 'active_record' module Incline::Extensions ## # Patches the TimeZoneConverter to call super. module TimeZoneConverter ## # Patches the TimeZoneConverter to call super. def self.included(base) base.class_eval do undef type_cast_from_user def type_cast_from_user(value) if value.is_a?(::Array) value.map { |v| type_cast_from_user(v) } else # Convert to time first. value = super # Then convert the time zone if necessary. if value.respond_to?(:in_time_zone) begin value.in_time_zone rescue ArgumentError nil end else nil end end end end end end end ActiveRecord::AttributeMethods::TimeZoneConversion::TimeZoneConverter.include Incline::Extensions::TimeZoneConverter
Version data entries
48 entries across 48 versions & 1 rubygems