Scoping option_groups_from_collection_for_select

How can I scope the options returned by option_groups_from_collection_for_select?

Method calls look like this: option_groups_from_collection_for_select (collection, group_method, group_label_method, option_key_method, option_value_method, selected_key = nil)

But say I want to limit the results returned by the option_key and option_value methods to some particular scope?

For instance, using the sample code in rdoc:

  class Continent < ActiveRecord::Base     has_many :countries     # attribs: id, name   end   class Country < ActiveRecord::Base     belongs_to :continent     # attribs: id, name, continent_id   end

I could get all countries grouped by continent with this:   option_groups_from_collection_for_select (@continents, :countries, :name, :id, :name, 3)

But say I had another class called Ally:

  class Alliance < ActiveRecord::Base     has_many :countries #reciprocal belongs_to added to country     #attribs: id, name   end

How could I scope the OGFCFS call so that it only listed countries belonging to a particular alliance?