Assume, we have two tables: "Items" and "Types". The relationships are:
item belongs_to type
type has_many items
Also, the Item table have a column, let's call it "mark". What would be a query (in a Rails secure way if it's possible) to extract all the types from them Types table, wich have connected items in Items table with a "mark"?