-
Notifications
You must be signed in to change notification settings - Fork 134
Description
because of some reason,I have to do like this:
class Fabric < ActiveRecord::Base
has_many :fabric_material_records
end
class FabricMaterialRecord::Base
belongs_to :fabric
belongs_to :material, :class_name => "Fabric"
end
however,as the result:
FabricMaterialRecord.material_number_like("PP");
will give on the console:(It's error)
FabricMaterialRecord Load (0.1ms) SELECT fabric_material_records.* FROM fabric_material_records INNER JOIN fabrics ON fabrics.id IS NULL WHERE (fabrics.number LIKE '%PP%')
FabricMaterialRecord.fabric_number_like("PP")
will give(It's correct!)
FabricMaterialRecord Load (0.1ms) SELECT fabric_material_records.* FROM fabric_material_records INNER JOIN fabrics ON fabrics.id = fabric_material_records.fabric_id WHERE (fabrics.number LIKE '%PP%')
I'll have see one issue at #8, but nobody has given the solution!
Please help me, thanks!