Many to many relation in one model

Damaris Fuentes wrote:

Hi you all,

I have a model called Property where a property is related with many properties. I was gonna deal with this by having a has-and-belongs-to-many relation but... what should I write in the SQL database? Would it be a "properties_properties" table? And the attributes? :S

has_and_belongs_to_many :properties, :foreign_key => 'parent_id'

properties_properties would look like parent_id int property_id int

Or you can use a different name by specifying the table name in the habtm