How to delete a set of records


#1

I’m trying to delete a set of records from the database using parameters
other than the primary key. Is there a method similar to find_by_sql()
that can be used to issue a delete statement like this. Thanks in
advance.

Shaun


#2

On 11/22/05, Shaun removed_email_address@domain.invalid wrote:

I’m trying to delete a set of records from the database using parameters
other than the primary key. Is there a method similar to find_by_sql()
that can be used to issue a delete statement like this. Thanks in
advance.

Shaun

Foo.destroy_all ‘bar < 5’

http://rails.rubyonrails.com/classes/ActiveRecord/Base.html#M000698


rick
http://techno-weenie.net


#3

technoweenie wrote:

On 11/22/05, Shaun removed_email_address@domain.invalid wrote:

I’m trying to delete a set of records from the database using parameters
other than the primary key. Is there a method similar to find_by_sql()
that can be used to issue a delete statement like this. Thanks in
advance.

Shaun

Foo.destroy_all ‘bar < 5’

http://rails.rubyonrails.com/classes/ActiveRecord/Base.html#M000698


rick
http://techno-weenie.net

Just what I was looking for. Thanks Rick.