I’m a total newbie on this, and I’m learning at baby steps, I am
really excited from what I’ve learned with Ruby on Rails, but I have
hit a wall here, I hope someone can help me to figure this out.
I’m trying to implement what I think is a simple relation between 3
kinds of data:
Machine, Kind, Product
- Machine can have many Kinds (I used HABTM and a join table, and used
check boxes in the view, ready, no problems in here)
- Product(s) must have one Kind (Used has_many and belongs_to, using a
select_tag for the view, no trouble here)
Now what is giving me some headaches:
-Machine must list the Product(s) that share the same Kind <== How can
I implement this? any suggestions or ideas?
I tried has_many => through, but it seems that I am misunderstanding
class Machine < AR
has_many :products, :through => :kinds ???
All errors are very explicit telling me that I’m missing a column, but
the thing here is, how can I call the same Kind on two different
things, how can I call Products that have the same Kind as Machine?