def enforce_timezone(&block)
      begin
        if @force_timezone
          zone = ActiveRecord::Base.default_timezone
          ActiveRecord::Base.default_timezone = @force_timezone
        end

        yield if block_given?
      ensure
        ActiveRecord::Base.default_timezone = zone if @force_timezone
      end
    end
def enforce_timezone(&block)
      begin
        if @force_timezone
          zone = ActiveRecord::Base.default_timezone
          ActiveRecord::Base.default_timezone = @force_timezone
        end

        yield if block_given?
      ensure
        ActiveRecord::Base.default_timezone = zone if @force_timezone
      end
    end
Private: Forces ActiveRecord's default timezone for duration of block.