Assuming a schema like such:
create table node ( id integer primary key, name varchar(32) ); create table nodelink ( source_id integer, destination_id integer );
A Rails association like this would supposedly do the job:
has_and_belongs_to_many :nodes, :join_table => 'nodelink', :association_foreign_key => 'destination_id', :foreign_key => 'source_id'