How to create a LOV [ List of Values in a Rails Application ]

I have 3 tables for a Sarbanes Oxley application. Servers , Databases and Applications.

another set of tables for the Model: Servers_Databases, Databases_Applications and Servers_Applications.

My question here is how can setup a LOV in order to let the join tables have a LOV from the Servers, Databases or Applications.

How would the model be applied in has_many ... :trough ....

This is really cool but a little bit confusing.

Thanks in advance for your help....

Thank you Mike for your reply here is layout of the current tables: 3 Main tables: servers , dbs , apps [ For some reason scaffold_resource did not like the work database/s application/s]

These 3 tables work together with the tables: app_svrs, db_apps and db_svrs

DROP TABLE IF EXISTS `prs_sarbox_development`.`servers`; CREATE TABLE `prs_sarbox_development`.`servers` (   `id` int(11) NOT NULL auto_increment,   `name` varchar(255) default NULL,   `cat` varchar(255) default NULL,   `net_face` int(11) default NULL,   `ids` int(11) default NULL,   `mon_man` int(11) default NULL,   `mon_aut` int(11) default NULL,   `int_ip` varchar(255) default NULL,   `ext_ip` varchar(255) default NULL,   `desc` varchar(255) default NULL,   `bu_media` varchar(255) default NULL,   `bu_method` varchar(255) default NULL,   `bu_data_freq` varchar(255) default NULL,   `os_vendor` varchar(255) default NULL,   `os` varchar(255) default NULL,   `os_version` varchar(255) default NULL,   PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `prs_sarbox_development`.`dbs`; CREATE TABLE `prs_sarbox_development`.`dbs` (   `id` int(11) NOT NULL auto_increment,   `name` varchar(255) default NULL,   `cat` varchar(255) default NULL,   `description` varchar(255) default NULL,   `mon_man` int(11) default NULL,   `mon_auto` int(11) default NULL,   PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `prs_sarbox_development`.`apps`; CREATE TABLE `prs_sarbox_development`.`apps` (   `id` int(11) NOT NULL auto_increment,   `name` varchar(255) default NULL,   `fsa` int(11) default NULL,   `fsa_logic` varchar(255) default NULL,   `description` varchar(255) default NULL,   `bu_data` varchar(255) default NULL,   PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `prs_sarbox_development`.`app_svrs`; CREATE TABLE `prs_sarbox_development`.`app_svrs` (   `id` int(11) NOT NULL auto_increment,   `server_id` int(11) default NULL,   `app_id` int(11) default NULL,   PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `prs_sarbox_development`.`db_apps`; CREATE TABLE `prs_sarbox_development`.`db_apps` (   `id` int(11) NOT NULL auto_increment,   `db_id` int(11) default NULL,   `app_id` int(11) default NULL,   PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `prs_sarbox_development`.`db_svrs`; CREATE TABLE `prs_sarbox_development`.`db_svrs` (   `id` int(11) NOT NULL auto_increment,   `db_id` int(11) default NULL,   `server_id` int(11) default NULL,   PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1;

When I try to open the URL: http://192.168.2.148:3000/db_apps

I got the list of the content of the DB.

Db App 15 1 Show Edit Destroy 11 14 Show Edit Destroy 22 23 Show Edit Destroy 4 17 Show Edit Destroy 4 21 Show Edit Destroy 2 17 Show Edit Destroy 2 21 Show Edit Destroy 2 5 Show Edit Destroy 2 19 Show Edit Destroy 2 20 Show Edit Destroy

I would like to see instead of the ID of the DB or APP the Name that belongs to that Database of the Name of the Application from the DBs and Apps tables repectively. I might be missing something, when I create the migration run the rake db:migrate then later edit the model as follow:

app Model:

Thank you Mike for your reply here is layout of the current tables: 3 Main tables: servers , dbs , apps [ For some reason scaffold_resource did not like the work database/s application/s]

These 3 tables work together with the tables: app_svrs, db_apps and db_svrs

DROP TABLE IF EXISTS `prs_sarbox_development`.`servers`; CREATE TABLE `prs_sarbox_development`.`servers` (   `id` int(11) NOT NULL auto_increment,   `name` varchar(255) default NULL,   `cat` varchar(255) default NULL,   `net_face` int(11) default NULL,   `ids` int(11) default NULL,   `mon_man` int(11) default NULL,   `mon_aut` int(11) default NULL,   `int_ip` varchar(255) default NULL,   `ext_ip` varchar(255) default NULL,   `desc` varchar(255) default NULL,   `bu_media` varchar(255) default NULL,   `bu_method` varchar(255) default NULL,   `bu_data_freq` varchar(255) default NULL,   `os_vendor` varchar(255) default NULL,   `os` varchar(255) default NULL,   `os_version` varchar(255) default NULL,   PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `prs_sarbox_development`.`dbs`; CREATE TABLE `prs_sarbox_development`.`dbs` (   `id` int(11) NOT NULL auto_increment,   `name` varchar(255) default NULL,   `cat` varchar(255) default NULL,   `description` varchar(255) default NULL,   `mon_man` int(11) default NULL,   `mon_auto` int(11) default NULL,   PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `prs_sarbox_development`.`apps`; CREATE TABLE `prs_sarbox_development`.`apps` (   `id` int(11) NOT NULL auto_increment,   `name` varchar(255) default NULL,   `fsa` int(11) default NULL,   `fsa_logic` varchar(255) default NULL,   `description` varchar(255) default NULL,   `bu_data` varchar(255) default NULL,   PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `prs_sarbox_development`.`app_svrs`; CREATE TABLE `prs_sarbox_development`.`app_svrs` (   `id` int(11) NOT NULL auto_increment,   `server_id` int(11) default NULL,   `app_id` int(11) default NULL,   PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `prs_sarbox_development`.`db_apps`; CREATE TABLE `prs_sarbox_development`.`db_apps` (   `id` int(11) NOT NULL auto_increment,   `db_id` int(11) default NULL,   `app_id` int(11) default NULL,   PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `prs_sarbox_development`.`db_svrs`; CREATE TABLE `prs_sarbox_development`.`db_svrs` (   `id` int(11) NOT NULL auto_increment,   `db_id` int(11) default NULL,   `server_id` int(11) default NULL,   PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1;

When I try to open the URL: http://192.168.2.148:3000/db_apps

I got the list of the content of the DB.

Db App 15 1 Show Edit Destroy 11 14 Show Edit Destroy 22 23 Show Edit Destroy 4 17 Show Edit Destroy 4 21 Show Edit Destroy 2 17 Show Edit Destroy 2 21 Show Edit Destroy 2 5 Show Edit Destroy 2 19 Show Edit Destroy 2 20 Show Edit Destroy

I would like to see instead of the ID of the DB or APP the Name that belongs to that Database of the Name of the Application from the DBs and Apps tables repectively. I might be missing something, when I create the migration run the rake db:migrate then later edit the model as follow:

app Model: