On Sep 25, 2006, at 12:43 PM, Giles Bowkett wrote:

> @interactions = Interaction.find(:all,
>                                          :conditions =>
> ["involvement_type in (?)", %w(Inducer Inhibitor Substrate)],
>                                          :include =>
> :drugs).group_by(&:involvement_type)
>
> @interactions.keys.each do |key|
> instance_variable_set( "@#{key}", interactions[key].map {
> |i|i.drug.name}.to_set )
> end


script/plugin install svn://rubyforge.org/var/svn/ez-where

@interactions = Interaction.find_where(:all, :include => :drugs) { | 
interact, drug|
       interact .involvement_type === %w(Inducer Inhibitor Substrate)
}.group_by(&:involvement_type)


@interactions.keys.each do |key|
   instance_variable_set( "@#{key}", interactions[key].map {
      |i|i.drug.name}.to_set )
end



-Ezra