Sha256: 3bfa11699dec241d2de2516d7404f4d2a5a62b96a664fb0d8e526528d64c714c
Contents?: true
Size: 501 Bytes
Versions: 1
Compression:
Stored size: 501 Bytes
Contents
class LineItem < ActiveRecord::Base belongs_to :item, :polymorphic => true belongs_to :invoice, :touch => true # Validations validate :times, :presence => true, :numericality => true validate :price, :presence => true, :numericality => true validate :title, :presence => true # Attributes def assign_item=(value) self.item = value self.price = value.price self.title = value.title self.code = value.code end def total_amount times * price.to_f end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bookyt-0.0.1 | app/models/line_item.rb |