The current plan is to completely remove all AR-specific code from the
partial rendering. ActionORM is the first attempt to make that work, and
it's still in progress. Something like Mislav's solution will probably work.

-- Yehuda

On Fri, Apr 17, 2009 at 11:41 AM, Mislav Marohnić <[email protected]
> wrote:

> On Thu, Apr 16, 2009 at 11:26, Ryan Bates <[email protected]> wrote:
>
>>
>> I am building a Rails plugin which is somewhat similar to named scopes
>> and therefore behaves like an array. However it isn't a subclass of
>> Array
>
>
> I see now that the current check is pretty ugly:
>
>   if Array === partial_path ||
>     (defined?(ActiveRecord) &&
>      (ActiveRecord::Associations::AssociationCollection === partial_path ||
>       ActiveRecord::NamedScope::Scope === partial_path))
>     render_partial_collection(options.except(:partial).merge(:collection =>
> partial_path))
>
> How about simply:
>
>   if partial_path.respond_to?(:each) and not String === partial_path
>
> Are there use cases where models themselves will respond to "each", or
> where this approach could otherwise backfire?
>
> >
>


-- 
Yehuda Katz
Developer | Engine Yard
(ph) 718.877.1325

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to