Module: Harvixture::ActiveRecordExtension

Defined in:
lib/harvixture/active_record_extension.rb

Instance Method Summary collapse

Instance Method Details

#after_findObject



3
4
5
# File 'lib/harvixture/active_record_extension.rb', line 3

def after_find
  harvixture_model.write_fixture
end

#to_harvixtureObject



6
7
8
9
10
# File 'lib/harvixture/active_record_extension.rb', line 6

def to_harvixture
  lines = attributes.to_yaml.split("\n")
  lines.shift
  "\n#{self.class.table_name}_#{self.id}:\n  "  +  lines.join("\n  ")
end