From: David Heinemeier Hansson Date: 2004-12-21T19:19:07+09:00 Subject: Re: ActiveRecord: method find Segmentation fault > c=Customer.new(\"name\"=>\"liubin\",\"password\"=>\"passwd\") > c.save > puts \"new id is \"+c.id.to_s > cs=Customer.find(2) > cs.each{|c| puts \"user #{c.name} has password #{c.password}\"} If you want Customer to return an array, you need to ask it with one, like: customers = Customer.find([2]) customers.each { |c| puts "user #{c.name} has password #{c.password}" } You also don't want to escape the quotes as you did in the example. I don't know why Ruby crumbles and dies on it, though. Seems a bit excessive ;) -- David Heinemeier Hansson, http://www.basecamphq.com/ -- Web-based Project Management http://www.rubyonrails.org/ -- Web-application framework for Ruby http://macromates.com/ -- TextMate: Code and markup editor (OS X) http://www.loudthinking.com/ -- Broadcasting Brain