# Syntax for delete

**URL:** <https://www.ruby-forum.com/t/syntax-for-delete/108629>\
**Category:** Rails\
**Created:** [July 5, 2007, 2:43pm UTC](https://www.ruby-forum.com/t/syntax-for-delete/108629 "2007-07-05T14:43:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mahendra](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/779978/32.png) [@Mahendra](https://www.ruby-forum.com/u/Mahendra)\
**Post date:** [July 5, 2007, 2:43pm UTC](https://www.ruby-forum.com/t/syntax-for-delete/108629/1 "2007-07-05T14:43:40Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![Mahendra](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/779978/32.png) [@Mahendra](https://www.ruby-forum.com/u/Mahendra)\
**Post date:** [July 5, 2007, 9:32pm UTC](https://www.ruby-forum.com/t/syntax-for-delete/108629/2 "2007-07-05T21:32:08Z")

</div>

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  
([ActiveRecord::Base](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  
([ActiveRecord::Base](http://api.rubyonrails.org/classes/ActiveRecord/Base.html#M000997))

## –

Autopendium :: Stuff about old cars  
[http://autopendium.com](http://autopendium.com)
