class Combination < ActiveRecord::Base
has_and_belongs_to_many :baugruppe
end
class Group < ActiveRecord::Base
has_and_belongs_to_many :combination
end
# controller:
def foo
arr_group = Group.find :all, :include=>:combination, :conditions=>["group.id in (1,2)"] # finds all groups (with id 1 and 2 ) and its combinations
arr_group = Group.find :all, :include=>[:combination=>:group], :conditions=>["group.id in (1,2)"] # finds all groups (with id 1 and 2 ) and its combinations with its groups
# but:
# i try to find all groups which belong to the same combination, which mean for example an array of groups with id 1,2 and
# maybe 5 (because group_id=1/combination=1 and group_id=5/combination=1 in combination_group)
end