search for: newmateri

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

Did you mean: newmaster
2006 Feb 20
4
Obtaining the ID of a newly saved model object
...ethod like so: def creatematerial @material = Material.new(params[:material]) if @material.save flash[:notice] = "Material successfully created." end Ok so far, but now I want to retrieve that object that was just saved so that it can be used in the view. Something like... @newmaterial = Material.find(@material.id) is what I was thinking, but that doesn''t work as @material still has no id. The method finishes with a rendering of a table (this is an AJAX called method) render_partial ''listtable'', :layout => false end I want to grab the newly c...