Hi,
I''m looking to do something similar to this.
http://wiki.rubyonrails.com/rails/pages/Inheritance
but i''m having some trouble.
Currently I have two tables : patient IS A user
create table users (
id int not null auto_increment,
name varchar(51) not null,
type varchar(50) default null,
hashed_password varchar(40) not null,
primary key(id)
);
create table patients (
id int not null auto_increment,
user_id int not null,
first_name varchar(50) not null,
last_name varchar(50) not null,
... more details ..
type varchar(50) default null,
constraint fk_patient_login foreign key (user_id) references users(id),
primary key(id)
);
user.rb :
class User < ActiveRecord::Base
def parent
self.class.find(id)
end
end
patient.rb :
class Patient < User;
end
But when i try to run something generated by scaffold like
<!--[form:patient]-->
4: <p><label for="patient_first_name">First
name</label><br/>
5: <%= text_field ''patient'', ''first_name''
%></p>
I get an error
undefined method `first_name'' for #<Patient:0xf6a7a7ec>
Any links/ comments are greatly appreciated. Thank you.
-matt
*
*
*
**
*
_______________________________________________
Rails mailing list
Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails