Last active
August 29, 2015 14:17
-
-
Save andreaseger/e9e69bfe8c0a49f7760c to your computer and use it in GitHub Desktop.
active_type bug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ruby-2.2.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'active_record' | |
| require 'sqlite3' | |
| ActiveRecord::Base.establish_connection(:adapter => 'sqlite3', :database => ':memory:') | |
| ActiveRecord::Base.time_zone_aware_attributes = true | |
| ActiveRecord::Migration.class_eval do | |
| create_table :records do |t| | |
| t.datetime :start_time | |
| end | |
| end | |
| class Record < ActiveRecord::Base | |
| end | |
| require 'active_type' | |
| class TestType < ActiveType::Object | |
| attribute :start_time, :datetime | |
| end | |
| Time.zone = 'Hawaii' | |
| ['2015-03-02T08:23:18Z', Time.now.utc].each do |time| | |
| p time | |
| obj = Record.new.tap{|e| e.start_time = time } | |
| p obj.start_time | |
| obj = TestType.new.tap{|e| e.start_time = time } | |
| p obj.start_time | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # A sample Gemfile | |
| source "https://rubygems.org" | |
| gem 'activerecord' | |
| gem 'sqlite3' | |
| gem 'active_type' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| GEM | |
| remote: https://rubygems.org/ | |
| specs: | |
| active_type (0.3.4) | |
| activerecord (>= 3.2) | |
| activemodel (4.2.0) | |
| activesupport (= 4.2.0) | |
| builder (~> 3.1) | |
| activerecord (4.2.0) | |
| activemodel (= 4.2.0) | |
| activesupport (= 4.2.0) | |
| arel (~> 6.0) | |
| activesupport (4.2.0) | |
| i18n (~> 0.7) | |
| json (~> 1.7, >= 1.7.7) | |
| minitest (~> 5.1) | |
| thread_safe (~> 0.3, >= 0.3.4) | |
| tzinfo (~> 1.1) | |
| arel (6.0.0) | |
| builder (3.2.2) | |
| i18n (0.7.0) | |
| json (1.8.2) | |
| minitest (5.5.1) | |
| sqlite3 (1.3.10) | |
| thread_safe (0.3.5) | |
| tzinfo (1.2.2) | |
| thread_safe (~> 0.1) | |
| PLATFORMS | |
| ruby | |
| DEPENDENCIES | |
| active_type | |
| activerecord | |
| sqlite3 |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
updated the example. It is also broken for Time objects