Skip to content

Instantly share code, notes, and snippets.

@jamesgolick
Created May 31, 2010 21:40
Show Gist options
  • Select an option

  • Save jamesgolick/420306 to your computer and use it in GitHub Desktop.

Select an option

Save jamesgolick/420306 to your computer and use it in GitHub Desktop.
>> s
=> #<Status id: 10, created_at: "2010-05-11 15:42:27", author_id: 129315, body: "bsdf", last_comment_at: "2010-05-15 16:01:16">
>> b
=> #<Status id: 10, created_at: "2010-05-11 15:42:27", author_id: 129315, body: "bsdf", last_comment_at: "2010-05-15 16:01:16">
>> s.destroy
=> #<Status id: 10, created_at: "2010-05-11 15:42:27", author_id: 129315, body: "bsdf", last_comment_at: "2010-05-15 16:01:16">
>> s.destroyed?
=> true
>> b.destroy
=> #<Status id: 10, created_at: "2010-05-11 15:42:27", author_id: 129315, body: "bsdf", last_comment_at: "2010-05-15 16:01:16">
>> b.destroyed?
=> true
@jbr
Copy link
Copy Markdown

jbr commented May 31, 2010

I think http://gist.github.com/420314 does something like what you're looking for, but there's really three different questions "destroyed?" might ask -- one is "has the record this instance represents been destroyed?," another is "was the destroy action successful" and the third "has destroy been called on this record?" Rails currently answers the last one. You want the second one, which is what the patch provides.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment