Fix for the multiple 'find' aliasing side-effects

I would like to transfer to this
mailing list because I don’t think the RubyOnRails TicketQueue is the
right place for this discussion.

Any opinions?


technoweenie wrote:

I wouldn’t use it for the same reason i don’t use with_scope in
around_filters: it makes your code harder to read. When you see a lonely
little Article.find, you have to wonder what scopes are in effect.
Something like Article.find_published, or
@section.articles.find_published(…) is much clearer.

I have a similar point of view about this issue, scoping find makes the
code definitely harder to read, so I also suggest to avoid it as much as
possible, but that’s not my point.

Sometimes you might have the intention to do it the other way round, to
globally restrict access to records by a specific condition (by defining
a “global scope” on find, pagination, calculations, etc.), and then to
define some breakout methods. For an example, I just can refer to your
own acts_as_paranoid plugin (once again).

technoweenie wrote:

I just don’t see why this needs to be in core, that’s all.

That’s fine for me, it wasn’t my primary objective to get my plugin into
the core. I just wanted to point out the problem and to encourage plugin
developers to (re-)use my code for their applications to avoid the
already often enough described side-effects and to make the new code
more maintainable/readable.