Displaying 1 result from an estimated 1 matches for "groups_packages".
2006 Jan 25
1
Rails day 2: where is my association?
...package 1");
rails rpms
cd rpms
script/generate scaffold group
script/generate scaffold package
script/server&
http://localhost:3000/packages
notice there is no group_id column. Why?
Ok so moving on to the association, docs say I need to associate groups
and packages
CREATE TABLE `groups_packages` (
`id` INT( 255 ) NOT NULL AUTO_INCREMENT ,
`group_id` INT( 255 ) NOT NULL ,
`package_id` INT( 255 ) NOT NULL ,
PRIMARY KEY ( `id` )
) TYPE = innodb;
class Group < ActiveRecord::Base
has_many :packages
end
class Package < ActiveRecord::Base
belongs_to :group
end
now the default scaffo...