{"action":"opened","issue":{"url":"https://api.github.com/repos/praxis/praxis-mapper/issues/27","repository_url":"https://api.github.com/repos/praxis/praxis-mapper","labels_url":"https://api.github.com/repos/praxis/praxis-mapper/issues/27/labels{/name}","comments_url":"https://api.github.com/repos/praxis/praxis-mapper/issues/27/comments","events_url":"https://api.github.com/repos/praxis/praxis-mapper/issues/27/events","html_url":"https://github.com/praxis/praxis-mapper/issues/27","id":213415122,"number":27,"title":"praxis-mapper + activesupport 4.x do not play well together with Time","user":{"login":"stevecrozz","id":133328,"avatar_url":"https://avatars3.githubusercontent.com/u/133328?v=3","gravatar_id":"","url":"https://api.github.com/users/stevecrozz","html_url":"https://github.com/stevecrozz","followers_url":"https://api.github.com/users/stevecrozz/followers","following_url":"https://api.github.com/users/stevecrozz/following{/other_user}","gists_url":"https://api.github.com/users/stevecrozz/gists{/gist_id}","starred_url":"https://api.github.com/users/stevecrozz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevecrozz/subscriptions","organizations_url":"https://api.github.com/users/stevecrozz/orgs","repos_url":"https://api.github.com/users/stevecrozz/repos","events_url":"https://api.github.com/users/stevecrozz/events{/privacy}","received_events_url":"https://api.github.com/users/stevecrozz/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-03-10T18:22:22Z","updated_at":"2017-03-10T18:22:22Z","closed_at":null,"body":"Praxis mapper defines data accessors that freeze underlying data objects:\r\nhttps://github.com/praxis/praxis-mapper/blob/c391302b8ed7637fa40af9492868d19b913b81d3/lib/praxis-mapper/model.rb\r\n\r\nBut activesupport 4.x foolishly defines a to_time method that mutates Time objects:\r\nhttps://github.com/rails/rails/blob/v4.2.8/activesupport/lib/active_support/core_ext/date_and_time/compatibility.rb#L19-L25\r\n\r\nThis effectively prevents us from rendering models that have times and in our application logs we get:\r\n```\r\n2017-03-10 10:08:39 -0800: [] [ERROR] [WORKER] SAVE_TO_CACHE (failed) Account: 7954, Error: Attributor::DumpError: Error while dumping attribute last_volume_attachment of type V2::MediaTypes::Volume for context volume-F69NQB79UM6HV. Reason: can't modify frozen Time, Cause: can't modify frozen Time\r\n2017-03-10 10:08:39 -0800: [] [ERROR] [WORKER] SAVE_TO_CACHE (failed) Backtrace:\r\n/home/stevecrozz/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/praxis-blueprints-3.3/lib/praxis-blueprints/renderer.rb:79:in `rescue in block (2 levels) in _render'\r\n/home/stevecrozz/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/praxis-blueprints-3.3/lib/praxis-blueprints/renderer.rb:76:in `block (2 levels) in _render'\r\n/home/stevecrozz/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/praxis-blueprints-3.3/lib/praxis-blueprints/renderer.rb:75:in `each'\r\n/home/stevecrozz/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/praxis-blueprints-3.3/lib/praxis-blueprints/renderer.rb:75:in `each_with_object'\r\n/home/stevecrozz/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/praxis-blueprints-3.3/lib/praxis-blueprints/renderer.rb:75:in `block in _render'\r\n/home/stevecrozz/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.8/lib/active_support/notifications.rb:166:in `instrument'\r\n/home/stevecrozz/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/praxis-blueprints-3.3/lib/praxis-blueprints/renderer.rb:74:in `_render'\r\n/home/stevecrozz/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/praxis-blueprints-3.3/lib/praxis-blueprints/renderer.rb:50:in `render'\r\n/home/stevecrozz/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/praxis-blueprints-3.3/lib/praxis-blueprints/view.rb:35:in `render'\r\n/home/stevecrozz/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/praxis-blueprints-3.3/lib/praxis-blueprints/blueprint.rb:307:in `render'\r\n/home/stevecrozz/Projects/rs/account_overview/app/v2/modules/big_brother_stat_calculator.rb:550:in `rescue in block in render_resources'\r\n...\r\n```\r\n\r\nI dug into this for a while and ended up upgrading to activesupport 5.x which doesn't have this problem. I'm not sure on the right fix or even if praxis-mapper has a problem. IMO this is more of an activesupport 4.x problem, but since that's such a popular library and already superceded by 5.x, it seems unlikely that it can be fixed in activesupport."}}
{"actor":{"display_login":"stevecrozz"}}