Sha256: cba53017814d859a8061c6cf9e976cd294bc401dd5e23df852560ce39764cbb7
Contents?: true
Size: 316 Bytes
Versions: 45
Compression:
Stored size: 316 Bytes
Contents
# Example from 'Overwriting default accessors' in ActiveRecord::Base. class Song < ActiveRecord::Base has_paper_trail # Uses an integer of seconds to hold the length of the song def length=(minutes) write_attribute(:length, minutes.to_i * 60) end def length read_attribute(:length) / 60 end end
Version data entries
45 entries across 45 versions & 3 rubygems