You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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!
The text was updated successfully, but these errors were encountered:
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
.* FROMfabric_material_records
INNER JOINfabrics
ONfabrics
.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
.* FROMfabric_material_records
INNER JOINfabrics
ONfabrics
.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!
The text was updated successfully, but these errors were encountered: