How do I map this relation?

Ok, these are 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 statussir(id_statussir)
);

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”

#Relations

What do I put here to map that relation???

End

Thank you

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs