Overriding has_many :through

Hi!

I have two classes, 'node' and 'way', linked by 'way_node'. It's a
fairly straightforward relationship:

node:
  has_many :way_nodes
  has_many :ways, :through => :way_nodes

way:
  has_many :way_nodes, :foreign_key => 'id', :order => 'sequence_id'
  has_many :nodes, :through => :way_nodes, :order => 'sequence_id'

way_node:
  belongs_to :node
  belongs_to :way, :foreign_key => :id

This typically results in queries like:
  SELECT [blah] FROM nodes
  LEFT OUTER JOIN way_nodes ON (nodes.id = way_nodes.node_id)
  LEFT OUTER JOIN ways ON (ways.id = way_nodes.id)

However, for one single query in the app, I'd like to join via a
different table. In other words:
  SELECT [blah] FROM nodes
  LEFT OUTER JOIN new_table ON (nodes.id = new_table.node_id)
  LEFT OUTER JOIN ways ON (ways.id = new_table.id)

Is there any way of doing this? I'd wondered about the :joins option in
'find', but it only adds additional joins, rather than replacing the
existing ones.

Thanks for any help!

cheers
Richard

How about

has_many :ways2, :class_name => "Way", :through => :new_ways

You'd need another model for new_ways and appropriate associations to
way.

Thanks - after another suggestion I ended up doing something very
similar:

node.rb:
  has_many :old_way_nodes
  has_many :ways_via_history, :class_name=> "Way", :through =>
:old_way_nodes, :source => :way

old_way_node.rb:
   belongs_to :way, :foreign_key=> :id

The :source meant I didn't even have to set up a new model.