On Jan 3, 9:27 am, acreadinglist <[email protected]> wrote:
> Can someone clarify what type of object is returned from a find
> (:select => ...) statement that only selects a subset of the records
> columns?

Foo.find always returns instances of Foo. That instance may have extra
attributes, it may have fewer attributes or the attributes may have
values other than what they would have if you had just done Foo.find
(1). Not sure what you mean by multiple types of Foo

Fred
>
> If I have an object Foo with attributes A and B, and call find(:select
> => "A"), is the object that's returned still a Foo object?  Is it a
> new Foo object?  Does it not have a B attribute (which would mean
> there would exist more than one type for Foo)? or is the B attribute
> simply nil?
>
> Is there a way to replicate the behavior of the :select on an object -
> to return an object that appears to be the same type but has a subset
> of the attributes?
>
> Thank you,
> Andrew

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" 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-talk?hl=en.


Reply via email to