Hi,
I am pulling my hair out trying to work out how to put together what
should be a simple app in rails. The app is to CV’s so I have a table of
CV’s and each CV can have multiple skills. Skills are in a 2nd table
below;
CREATE TABLE cvs(
id INT not null AUTO_INCREMENT PRIMARY KEY,
first_name VARCHAR(30) not null,
family_name VARCHAR(30) not null,
email VARCHAR(200) not null,
telephone varchar(20) not null,
address_1 varchar(30) not null,
city varchar(30) not null,
county varchar(30) not null,
post_code varchar(9) not null,
created_on timestamp(14) not null,
updated_on timestamp(14) not null
);
CREATE TABLE skills(
id INT not null AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(20) not null,
detail VARCHAR(200) not null,
cv_id int not null,
created_on timestamp(14) not null,
updated_on timestamp(14) not null,
constraint fk_skills_cv foreign key (cv_id) references cvs(id)
);
Now, I think the db is as it should be from what I have been able to
gleen from Agile…, 4 days… and OnLamp…
So now I have the view for the CV in place with a link to ‘Add a Skill’
which goes;
<%= link_to “add_skill”, :controller => “cv_admin”, :action =>
“new_skill” , :id => cv.id %>
But what should I put in the Controller & skill model to;
a. Create the skill with an association to the CV?
b. Find the skills associated with the CV so I can display them?
Just a couple of snippets would be fantastic, I just cannot find any
documentation anywhere that brings this simple concept together.
Thanks