Hi,
I have this piece of code,
if @quote.save
flash[:notice] = ''Quote was successfully created.''
#return id of preiously inserted quote
#enter this id in the correct related project field
redirect_to :action => ''list''
end
How can I return the id of the saved data?
--
Posted via http://www.ruby-forum.com/.
On 5/9/06, ss <scott@boxuk.com> wrote:> Hi, > > I have this piece of code, > > if @quote.save > flash[:notice] = ''Quote was successfully created.'' > #return id of preiously inserted quote > #enter this id in the correct related project field > redirect_to :action => ''list'' > end > > How can I return the id of the saved data?@quote.id, or just @quote, should return a value once the record''s been saved. -Isak
ss wrote:> Hi, > > I have this piece of code, > > if @quote.save > flash[:notice] = ''Quote was successfully created.'' > > #return id of preiously inserted quote > > #enter this id in the correct related project field > > redirect_to :action => ''list'' > > end > > How can I return the id of the saved data?yes, you can use @quote.id after being saved, before being saved you can not use @quote.id -- Posted via http://www.ruby-forum.com/.