I'm trying to make friends and enemies connections with has_and_belongs_to_many, therefore I created the following:
create_table :people do |t|
t.string :name
end
create_table "relations", :id => false do |t|
t.integer "person_a_id", :null => false
t.integer "person_b_id", :null => false
t.boolean :friends
end
The first stage I wished to accomplish is defining Person: HABTM relations, and later on defining scopes. Now I'm having troubles defining the connection in Person since has_and_belongs_to_many has :foreign_key and :association_foreign_key, so if A is a friend of B, B is not a friend of A. I've searched through HABTM notes, and the only option I found is setting manually :finder_sql and :delete_sql. I'm pretty sure there must be an elegant solution I'm missing.
Thanks