Forum: Ruby on Rails how do I map this relation?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Rodrigo D. (Guest)
on 2006-01-29 06:44
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 topic is locked and can not be replied to.