Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Re: ActiveRecord: method find Segmentation fault
David Heinemeier Hansson
12/21/2004 10:19:00 AM
> 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.basec...
-- Web-based Project Management
http://www.rubyon...
-- Web-application framework for Ruby
http://macro...
-- TextMate: Code and markup editor (OS X)
http://www.loudthi...
-- Broadcasting Brain
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Re: ActiveRecord: method find Segmentation fault
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password