Skip to content

Instantly share code, notes, and snippets.

View rusterholz's full-sized avatar

Andy Rusterholz rusterholz

  • ezCater, Inc.
  • Longmont, CO
View GitHub Profile
foo: "This is a fake file for testing purposes."
Cedar:bug rusterholz$ irb
2.5.0 :001 > class Foo
2.5.0 :002?> def bar
2.5.0 :003?> :baz
2.5.0 :004?> end
2.5.0 :005?> end
=> :bar
2.5.0 :006 > Foo.new.method(:bar).super_method
=> nil
2.5.0 :007 > Foo.instance_method(:bar).bind(Foo.new).super_method
@rusterholz
rusterholz / patch_versions.rb
Last active February 10, 2016 23:20
Migration to fix serialized attributes on Versions made with paper_trail 4.0.2 or earlier
class PatchVersions < ActiveRecord::Migration
# This modifies PaperTrail versions made with 4.0.2 or before to be compatible with 4.1.0.
#
# The difference is that 4.0.2 stored serialized attributes in their native (reified) form,
# while 4.1.0 and above store serialized attributes in their serialized form; e.g.:
# {'foo'=>52, 'bar'=>'baz'} <----- 4.0.2 yamlizes this Hash
# '{"foo":52,"bar":"baz"}' <----- 4.1.0 yamlizes this String
# This causes 4.1.0 to raise errors when attempting to reify versions created with 4.0.2.
#
begin
self.ass.shake!
watch self
self.ass.shake!
puts self.instance_variables.inspect
end