Forum: Ruby on Rails how to map a relation?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
8d79a081e726563e89e73faaf59997d5?d=identicon&s=25 Rodrigo Dominguez (Guest)
on 2006-01-29 04:08
(Received via mailing list)
Ok, this is the tables

create table statussir (
idstatussir primary key int auto_numeric,
description varchar(255)

create table statussir_next (
            idstatussir int not null,
            idstatussir_next not null,
            foreign key idstatussir references statussir(id_statussir),
            foreign key idstatussir_next references

so, the idea is that you have many states
idstatussir        description
1                                          Not Started
2                                          Assigned
3                                          In Planning
4                                          In Progress
5                                          Finished
6                                          Cancelled

And then statussir_next tells you how can you pass to the next states
Idstatussir       idstatussir_next
1                                          2
1                                          6
2                                          3
2                     6
3                                          4
3                     6
4                     5
4                     6

I donÂ?t know how to map that, I have

class StatusSIR < ActiveRecord::Base
            #Table name and primary key
            set_table_name "statussir"
            set_primary_key "idstatussir"
            # What do I put here to map that relation?????

Thank you

Rodrigo Domínguez
Iplan Networs
 <> Â?
 <> Â?
This topic is locked and can not be replied to.