Displaying 1 result from an estimated 1 matches for "invoices_raised".
2006 Nov 07
2
undefined local variable or method `invoices' for Provider:Class
...wledge of Rails/Ruby has ...
I have the following models:
[ -- Begin -- ]
class Provider < ActiveRecord::Base
has_many :invoices
has_one :user
def self.get_invoices
invoices.find(:all)
end
end
class User < ActiveRecord::Base
belongs_to :Provider
belongs_to :Consumer
def invoices_raised
Provider.get_invoices
end
...
end
[ -- End -- ]
and when I call User.invoices_raised I get this error:
undefined local variable or method `invoices'' for Provider:Class
Now I thought that having the "has_many :invoices" line would
automatically make the connection an...