search for: padmin_id

Displaying 1 result from an estimated 1 matches for "padmin_id".

Did you mean: admin_id
2006 Apr 25
3
belongs_to and has_many
...;? Is it the field name minus the _id? :foreign_key is the key in the other table. :class_name is the name of the model of the other table. ------createtables.sql CREATE TABLE admins( id INTEGER PRIMARY KEY, admin VARCHAR(32) NOT NULL, ); CREATE TABLE machines( id INTEGER PRIMARY KEY, padmin_id REFERENCES admins(admin), sadmin_id REFERENCES admins(admin) ) -------models/machine.rb------------ class Machine < ActiveRecord::Base belongs_to :padmin, :class_name => "admin", :foreign_key => "id" belongs_to :sadmin, :class_name => "admin", :foreig...