parent table = cars
related table = parts
c = car.find_by_id(1)
c.part.new(:car_id => 1, :part_name => “gas pedal”, :color => “black”)
I can’t get this to work. How can I do this? How do I find what methods I can use for this relationship?
parent table = cars
related table = parts
c = car.find_by_id(1)
c.part.new(:car_id => 1, :part_name => “gas pedal”, :color => “black”)
I can’t get this to work. How can I do this? How do I find what methods I can use for this relationship?
Hi @kimkhan, I believe you can do `c.parts.build(params)
You can read more about the methods available here
c.parts.new(params) # will also work
The key is pluralizing parts… As @pedromoreira indicated.
Ok. Yes, that is a good resource. Thanks for the tip.