I have an issue related to rails.
The class definition is given below.
class Supplier < ActiveRecord::Base
has_one :criteria
self.primary_key = 'sup_id'
end
class Criteria < ActiveRecord::Base
belongs_to :supplier, :foreign_key => "crt_sup_id"
self.primary_key = 'crt_id'
self.table_name = 'criterias'
end
If I am using self.supplier in class Criteria it is working fine
but If I am using self.criteria in class Supplier then error thrown as,
Unknown column ‘criteria.supplier_id’ in ‘where clause’: SELECT
criteria
.* FROM criteria
WHERE criteria
.supplier_id
I don’t have a field named supplier_id in criteria instead I am using
crt_sup_id as defined in the class.
Please help on this.
Thanks.