has_many :through - to self, bi-directional


I've got a model (Feature) that is "related" to other Features. The
name of the has_many is "relations".

There is a join table called FeatureRelation, which holds a feature_id
and a related_feature_id. Something like:

class Feature
  has_many :relations, :class_name=>'FeatureRelation'

But I don't want just the relations that a feature has created. I want
the relations that other features have created *to* and *from*. Here
is an example that might show what I mean (doesn't work):

class Feature

has_many :relations, :class_name=>'FeatureRelation', :conditions=>'feature_id
= #{id} OR related_feature_id = #{id}'

But this still doesn't do it. How can I combine the features being
related to and from together? Like:

Feature.find(1).relations == 'All features relations with feature_id
or related_feature_id equal to 1'