Hi John,
Using your example:
visits.each do |visit|
visit.coming?
end
HTH
Trevor
--
Trevor Squires
http://somethinglearned.com
On 30-Mar-06, at 3:03 PM, John Smilanick wrote:
> I have a class that has_many :visits, I want to search through the
> visits to get only ones that are committed:
> I thought it would be as easy as:
> =================> visits.find_all do |visit|
> visit.coming?
> end
> ================>
> but this always returns the entire list of visits. The only way to
> get it to work is to put the visits into a new array first:
> ================> Array.new(visits).find_all do |visit|
> visit.coming?
> end
> =================>
> Can someone explain this to me?
>
> -John
>
> --
> John Smilanick
> Computing Staff - Webmaster
> Kavli Institute for Theoretical Physics
> University of California, Santa Barbara
> jsmilani@kitp.ucsb.edu
> (805) 893-6307
>
>
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://wrath.rubyonrails.org/pipermail/rails/attachments/20060331/4d012f89/attachment-0001.html