Skip to content

Instantly share code, notes, and snippets.

@coderforhire
Created November 12, 2012 18:54
Show Gist options
  • Save coderforhire/d13d51112d23ca4ba2c5 to your computer and use it in GitHub Desktop.
Save coderforhire/d13d51112d23ca4ba2c5 to your computer and use it in GitHub Desktop.
def total_qty
self.ys_qty.to_i + self.ym_qty.to_i + self.yl_qty.to_i
+ self.yxl_qty.to_i + self.s_qty.to_i + self.m_qty.to_i
+ self.l_qty.to_i + self.xl_qty.to_i + self.two_xl_qty.to_i
+ self.three_xl_qty.to_i + self.four_xl_qty.to_i
+ self.five_xl_qty.to_i + self.six_xl_qty.to_i
end
@job
=> #<Job id: 2, created_at: "2012-11-12 18:46:16", updated_at: "2012-11-12 18:52:29", total_qty: nil, shirt_quality: "Standard", art: nil, customer_id: 1, turn_around: "Rush! (shipped in 1-3 days)", art_file_name: nil, art_content_type: nil, art_file_size: nil, art_updated_at: nil, ys_qty: 101, ym_qty: 10, yl_qty: 10, yxl_qty: 10, s_qty: 100, m_qty: 10, l_qty: nil, xl_qty: nil, two_xl_qty: nil, three_xl_qty: nil, four_xl_qty: nil, five_xl_qty: nil, six_xl_qty: 10, placement: "Placement", special_instructions: "">
1.9.3-p0 :006 > @job.total_qty
=> 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment