Forum: Ruby on Rails how to show a fied FK - belongs_to

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.
51bb5688c8c2c1b68d03c56da8e0b696?d=identicon&s=25 Alfredo Gama (alfredogz)
on 2007-01-09 16:45
Hi,

i have two tables

CREATE TABLE `categories` (
  `id`          int(11)      NOT NULL auto_increment,
  `name`        varchar(50)  DEFAULT NULL,
  PRIMARY KEY (`id`)
);

CREATE TABLE `forums` (
  `id`          int(11)      NOT NULL auto_increment,
  `category_id` int(11)      DEFAULT NULL,
  `name`        varchar(50)  DEFAULT NULL,
  `description` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`id`)
);

I wanna show the name field of the forums table, buy in the line of the
all fields of the table categories like:
id  category      name             description
1  programming   C++               tutorials of C++
2  religion      chrismas card     hi all

how to code this??
This topic is locked and can not be replied to.