Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

class_name #157

Open
justqyx opened this issue May 15, 2012 · 0 comments
Open

class_name #157

justqyx opened this issue May 15, 2012 · 0 comments

Comments

@justqyx
Copy link

justqyx commented May 15, 2012

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!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant