2009/5/12 pharrington <[email protected]>

>
> If you want to retrieve just the name, than use the :select option
> with your find:
>
> @children = Child.find(:all, :include => :mother, :select => 'name')
>

Does that select child.name or mother.name?
Colin


>
> On May 12, 11:04 am, Colin Law <[email protected]> wrote:
> > 2009/5/12 Anthony Ward <[email protected]>
> >
> >
> >
> > > Hi thank you
> >
> > > so if I use the include
> > > how do i just retrieve the name then
> >
> > Do you mean you want a query finding the child, including the
> > mother.namebut not the other mother fields?  I do not know whether you
> > can do that.  I
> > think the overhead of fetching all columns is going to be rather small.
> > Colin
> >
> >
> >
> > > example this is using the "magic way"
> >
> > > @children do |child|
> >
> > >  ... print child.mother.name
> >
> > > end
> >
> > > --
> > > Posted viahttp://www.ruby-forum.com/.
> >
>

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