How in would one associate comments to an environment according to the
change on which it’s called through?
i.e.
change = Changes.find(params[:change_id:])
print “For change #{change.id}\n”
change.environments.each do |env|
print “-- For environment #{env.name}\n”
env.comments.each do |c|
“---- #{c.body}\n”
end
end
I assume from the lack of response that this is easy and well-
documented. I’ll keep looking.
No it’s neither. But an illustration of your planned schema would
help.
It may be that you have a modelling problem or that there is a
polymorphic aspect to your core models or your join tables.
In addition you don’t state whether you are using HABTM or
has_many :through for your many-many associations.
In any case I just figured out HABTM and HM :T 2 weeks ago,
and this is at the edge of my ability.
There’s a blog out there called ‘has many through’ google for it
or check the Ruby blogrolls. The guy in question is excellent
when it comes to explaining or working around the bleeding
edge of these kind of questions. You might get better answers
there.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.