Displaying 3 results from an estimated 3 matches for "cv_admin".
2006 Mar 04
5
has_many and belongs_to example?
Hi!
If i have 2 tables i.e. product and images and product has_many images,
image belongs_to product - how to create _form.rhtml, new/create and
edit/update methods in product controller, so in a single form i can add
one product and MANY (let''s assume for now that this number is fixed)
images for this product?
Pleeeeease help me :)
--
Posted via http://www.ruby-forum.com/.
2006 Feb 27
6
One to Many example... please!
...nces 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 ju...
2006 Mar 04
1
validation for items in a 1 2 many
...kill = Skill.new
end
def create
@cv = Cv.find(@session[:cv_id])
@cv.skills << Skill.new(params[:skill])
if @cv.save
flash[:notice] = ''Skill was successfully created.''
redirect_to :action => ''show'', :controller => ''cv_admin'', :id =>
@cv
else
render :action => ''new''
end
end
Having got the create method to populate correctly, the validation
helpers in the skills model have stopped working they trap errors on the
form and send the form back, but the;
<%= error_mes...