search for: invoice_lin

Displaying 3 results from an estimated 3 matches for "invoice_lin".

Did you mean: invoice_line
2007 Nov 29
3
Strange Array behaviour
I''m having a strange thing when using the Enumerable extensions for Rails: Have a look at the following code: class Invoice < ActiveRecord::Base has_many :invoice_lines def total invoice_lines.sum(&:total) end end class InvoiceLine < ActiveRecord::Base belongs_to :invoice def total amount * price end end Now, when calling invoice.total, I get wrong number of arguments (1 for 2) error, but when changing the the total method in Invoice...
2006 Jun 06
3
Invoice and invoice_lines
Hello People, I have a possibly very lame question. I am fairly new to RoR, and I want to make sure I do it "right". I have a model called Invoice, and one called InvoiceLines. Usual story: the table "invoice" has a 1:n relationship with "invoice_lines", which includes invoice_id. Now... the application will have a "new order" button, which will allow the user to enter all of the order details, etc. Then, the user will want to add invoice_lines, which are obviously associated with the order. The easiest solution I can think...
2010 Feb 19
8
Weird gsub behaviour
ruby 1.8.6 (2007-09-24 patchlevel 111) str = ''\&123'' puts "abc".gsub("b", str) puts "abc".gsub("b", "#{str}") puts "abc".gsub("b", str.to_s) puts "abc".gsub("b", ''\&123'') puts "abc".gsub("b", "\&123") >ruby test.rb ab123c