chuckg/rails3_acts_as_paranoid — comment on commit 82771cd10f4147a0f42f3dc5e1a53e7a69ed146b
File: lib/acts_as_paranoid/associations.rb line 22
By chuckg:

`#{result.klass}` could alternatively be written as `association(:#{target}).klass` and, although it references the same object (exactly, I think), could potentially be seen as a "cleaner" way of accomplishing the same. The difference here is in the meta:

```ruby
class Forest < ActiveRecord::Base
acts_as_paranoid
has_many :trees
end

class Tree < ActiveRecord::Base
belongs_to :forest, :with_deleted => true
end
```

Using `#{result.klass}`, results in the following meta code being output:

```ruby
def forest_with_unscoped(*args)
return forest_without_unscoped(*args) unless Forest.paranoid?
Forest.unscoped { forest_without_unscoped(*args) }
end
```

And `association(:#{target}).klass`:

```ruby
def forest_with_unscoped(*args)
return forest_without_unscoped(*args) unless association(:forest).klass.paranoid?
association(:forest).klass.unscoped { forest_without_unscoped(*args) }
end
```