Last active
August 29, 2015 14:14
-
-
Save smathy/2f4536d3e59b7a52c855 to your computer and use it in GitHub Desktop.
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
[20] pry(main)> class Foo < ActiveRecord::Base | |
[20] pry(main)* end | |
=> nil | |
[21] pry(main)> f = Foo.new phone_numbers: {"dario" => "12345"} | |
=> #<Foo:0x007fc69ba76228 id: nil, name: nil, phone_numbers: "{\"dario\"=>\"12345\"}", created_at: nil, updated_at: nil> | |
[22] pry(main)> f.phone_numbers.class | |
=> String | |
[23] pry(main)> class Foo < ActiveRecord::Base | |
[23] pry(main)* serialize :phone_numbers | |
[23] pry(main)* end | |
=> #<ActiveRecord::AttributeDecorators::TypeDecorator:0x007fc69dbba768 | |
@decorations= | |
{"_time_zone_conversion"=> | |
[#<Proc:0x007fc6a009b4b0@/Users/jk/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activerecord-4.2.0/lib/active_record/attribute_methods/time_zone_conversion.rb:49 (lambda)>, | |
#<Proc:0x007fc6a009b3c0@/Users/jk/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activerecord-4.2.0/lib/active_record/attribute_methods/time_zone_conversion.rb:50>], | |
"_optimistic_locking"=> | |
[#<Proc:0x007fc6a00992a0@/Users/jk/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activerecord-4.2.0/lib/active_record/locking/optimistic.rb:174 (lambda)>, | |
#<Proc:0x007fc6a00991b0@/Users/jk/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activerecord-4.2.0/lib/active_record/locking/optimistic.rb:175>], | |
"_phone_numbers_serialize"=> | |
[#<Proc:0x007fc69dbbaf38@/Users/jk/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activerecord-4.2.0/lib/active_record/attribute_decorators.rb:12 (lambda)>, | |
#<Proc:0x007fc69dbbaf88@/Users/jk/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activerecord-4.2.0/lib/active_record/attribute_methods/serialization.rb:50>]}> | |
[24] pry(main)> f = Foo.new phone_numbers: {"dario" => "12345"} | |
=> #<Foo:0x007fc69db700c8 id: nil, name: nil, phone_numbers: {"dario"=>"12345"}, created_at: nil, updated_at: nil> | |
[25] pry(main)> f.phone_numbers.class | |
=> Hash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment