I have a simple Customer model which has id, firstName, lastName, address_id columns.
In the method I have the following method to add data to the database:
def self.add_customer(firstname, lastname)
@cust = Customer.new(:firstName => firstname, :lastName => lastname, :address_id => self.id)
@cust.save
end
This is giving me error
undefined method `id'
I'm using rails 2.3.5 I've seen this code working in many books. My Customer table does have an ID column. I've verified in actual DB.