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, so when one tries to pass it to a partial renderer...

<%= render :partial => @items %>

This does not work because it doesn't know it is a collection and
should be treated as an array. Taking a look at the Rails source both
in master and the 2.3 branch I can see that the NamedScope comparison
is hard-coded.

I think it would be better if ActionView knew nothing of ActiveRecord
here and instead offered some kind of standard that ActiveRecord and
others can follow. This would seem to flow with the more modular
approach that Rails 3 is taking.

I'm willing to write up a patch for this, but I want to get some
discussion going on how best to handle it. One idea is a documented
"collection_for_rails_partial?" method one can define in the object,
but that seems a bit ugly.

Also if there is a current solution (even if it's a hack) to work
around this problem in Rails 2.3 I'm all ears.

Ryan
--~--~---------~--~----~------------~-------~--~----~
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