HABTM pregunta

I have 2 habtm relations:

FORM <- HABTM-> COMPANIES
FORM <- HABTM -> SITES

Is there an easy way to do a query like:

Find out what sites belong to what company related to the form?

Also is there a better or more efficient way of setting this kind of
scenario up?

The FORM can have multiple companies associated as well as multiple
sites belonging to each company.