Skip to content

Instantly share code, notes, and snippets.

@phongleland
phongleland / fixture_maker.rb
Created February 6, 2018 21:37
Convert ActiveRecord objects into fixture
class FixtureMaker
def initialize(obj)
@obj = obj
end
def attributes
attributes ||= @obj.attributes.delete_if{|k,v| v.blank?}
end