Skip to content

Instantly share code, notes, and snippets.

@mallain
Created May 14, 2010 12:45
Show Gist options
  • Save mallain/401101 to your computer and use it in GitHub Desktop.
Save mallain/401101 to your computer and use it in GitHub Desktop.
mickael@mickael-laptop:~/projects/pabd$ script/console
Loading development environment (Rails 2.3.5)
>> Assignment.last
=> #<Assignment id: 5, agency_id: 1, account_id: 2, created_at: "2010-05-14 12:17:12", updated_at: "2010-05-14 12:17:12", account_type_id: 2>
>> AccountType.find(2)
=> #<AccountType id: 2, name: "Petit Compte", created_at: "2010-05-14 12:10:33", updated_at: "2010-05-14 12:10:33", deleted_at: nil>
>> AccountType.find(2).destroy
=> #<AccountType id: 2, name: "Petit Compte", created_at: "2010-05-14 12:10:33", updated_at: "2010-05-14 12:10:33", deleted_at: "2010-05-14 12:43:20">
>> AccountType.find(2)
ActiveRecord::RecordNotFound: Couldn't find AccountType with ID=2
from /var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:1586:in `find_one'
from /var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:1569:in `find_from_ids'
from /var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:616:in `find_without_find_wrapper'
from /home/mickael/projects/pabd/vendor/plugins/acts_as_paranoid/lib/caboose/acts/paranoid_find_wrapper.rb:79:in `send'
from /home/mickael/projects/pabd/vendor/plugins/acts_as_paranoid/lib/caboose/acts/paranoid_find_wrapper.rb:79:in `find'
from (irb):4
>> AccountType.find_with_deleted(2)
=> #<AccountType id: 2, name: "Petit Compte", created_at: "2010-05-14 12:10:33", updated_at: "2010-05-14 12:10:33", deleted_at: "2010-05-14 12:43:20">
>> Assignment.last
=> #<Assignment id: 5, agency_id: 1, account_id: 2, created_at: "2010-05-14 12:17:12", updated_at: "2010-05-14 12:17:12", account_type_id: 2>
>> Assignment.last.account_type
=> nil
@RobertDober
Copy link

Micka, d'où vient #find_with_deleted ? Cela me semble un plugin, non?

@mallain
Copy link
Author

mallain commented May 17, 2010

Oui, il vient de acts_as_paranoid. (http://github.com/technoweenie/acts_as_paranoid)

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