Rails : belongs_to and has_many using non-standard ids?

You must have a foreign key in your items table. I'm assuming barcode_identification_id is a column (foreign key) in items table. If you have some other column then just replace it with that Try like this: class Product "barcode_identification_id" end class Item.

You must have a foreign key in your items table. I'm assuming barcode_identification_id is a column (foreign key) in items table. If you have some other column then just replace it with that.

Try like this: class Product "barcode_identification_id" end class Item.

I resorted to rewriting the models. The application needed it anyway. Now it's a simple Product has_many Items using the standard rails association (and generic product_id, and ids for foreign keys and primary keys.).

Since you're specifying both primary and foreign key, why not class Product "identification_number", :primary_key => "barcode_identification" end class Item "barcode_identification", :primary_key => "identification_number" end.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions