Forum: Rails-core (closed, excessive spam) is named_scope a implementation of has_finder?

Posted by Jochen Kaechelin (Guest)
on 2008-05-19 18:39
(Received via mailing list)
Is the new named_scope feature a full implementation of has_finder?

I'am just coding about 50 has_finder lines and I asked myself if it's
a good idea to wait for 2.1 final and use named_scope instead.


--
Jochen
Posted by Josh Susser (jsusser)
on 2008-05-19 18:45
(Received via mailing list)
On May 19, 2008, at 9:38 AM, Jochen Kaechelin wrote:
> Is the new named_scope feature a full implementation of has_finder?
>
> I'am just coding about 50 has_finder lines and I asked myself if it's
> a good idea to wait for 2.1 final and use named_scope instead.


Yes, named_scope is the renamed and integrated-to-core port of
has_finder.

--
Josh Susser
http://blog.hasmanythrough.com
Posted by Mislav MarohniÄ? (mislav)
on 2008-05-20 10:41
(Received via mailing list)
On Mon, May 19, 2008 at 6:38 PM, Jochen Kaechelin <gissmoh@humanized.de>
wrote:

>
> I'am just coding about 50 has_finder lines and I asked myself if it's
> a good idea to wait for 2.1 final and use named_scope instead.


You don't have to wait for 2.1, you can use has_finder and just rename 
the
method when you update to Rails 2.1. The basic API is the same (I'm 
unaware
of differences).

If you're using will_paginate library, I backported named_scope there 
for
Rails 1.2.6 and 2.0.2. Just install mislav-will_paginate from GitHub and 
do
this:

gem 'mislav-will_paginate', '>=2.2.0'
require 'will_paginate'
WillPaginate::enable_named_scope

Of course, this detects native named_scope and has no effect when the 
app is
upgraded to Rails 2.1.
This topic is locked and can not be replied to.