# File rails-2.3.2/activerecord/lib/active_record/base.rb, line 2576
2576:       def destroy
2577:         unless new_record?
2578:           connection.delete(
2579:             "DELETE FROM #{self.class.quoted_table_name} " +
2580:             "WHERE
#{connection.quote_column_name(self.class.primary_key)} =
#{quoted_id}",
2581:             "#{self.class.name} Destroy"
2582:           )
2583:         end
2584:
2585:         freeze
2586:       end

i think <agile rails 3rd> could help you about primary key and id.

otherwise:
you can use DBI.
ActiveRecord::Base.connection().execute( "delete from table_name where id = ?")



2010/4/22 Lee Smith <[email protected]>:
> The finder works though.
>
> It looks like destroy relies specifically on the id column...maybe
> there's a way to tell it otherwise?
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to