Forum: Ruby on Rails strange has_many array problem

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
858392acd1398aa6071fb1d44cc33842?d=identicon&s=25 John Smilanick (Guest)
on 2006-03-31 01:05
(Received via mailing list)
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|

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:
================= do |visit|

Can someone explain this to me?


John Smilanick
Computing Staff - Webmaster
Kavli Institute for Theoretical Physics
University of California, Santa Barbara
(805) 893-6307
27c170f482104299af279902be0a9c26?d=identicon&s=25 Trevor Squires (Guest)
on 2006-03-31 02:21
(Received via mailing list)
Hi John,

Using your example:

visits.each do |visit|

Trevor Squires
This topic is locked and can not be replied to.