Syntax for delete

Hi,

I am saving my data using object.save like this:

@project = Project.new(params[:project])
@project.save

How can i delete same.
I am using
@project.delete
But it is giving me error.

Plz. help…

Mahendra wrote:

But it is giving me error.

Plz. help…

In general it’s always a good idea to say what the error is, but
normally you’d use destroy to achieve this:
@project.destroy
(http://api.rubyonrails.org/classes/ActiveRecord/Base.html#M001041).
delete is actually a class method that should be given the id or ids of
the records you want to delete
(http://api.rubyonrails.org/classes/ActiveRecord/Base.html#M000997)

Autopendium :: Stuff about old cars
http://autopendium.com

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs