>From the rails api docs examples (http://api.rubyonrails.org/classes/
ActiveRecord/Base.html#M002263):

...
  # find all
  Person.find(:all) # returns an array of objects for all the rows
fetched by SELECT * FROM people
  Person.find(:all, :conditions => [ "category IN (?)",
categories], :limit => 50)
  Person.find(:all, :conditions => { :friends => ["Bob", "Steve",
"Fred"] }
  Person.find(:all, :offset => 10, :limit => 10)
  Person.find(:all, :include => [ :account, :friends ])
  Person.find(:all, :group => "category")
...

Jeff

On May 14, 2:24 pm, Hubert Yoshizaki <[email protected]> wrote:
> Ahh, thanks. Should of thought of that one. Quick question, when you do
> a .find(:all) I'm assuming it returns an array of objects?
>
>
>
>
>
> Jeff Burlysystems wrote:
> > The .find_by_....(...) meth returns the first model object found (or
> > nil if none found), whereas .find(:all, ...) meth returns an array:
>
> > $ ./script/console
>
> >>> puts Foo.find_by_id(1).class
> > Foo
>
> >>> puts Foo.find_by_id(0).class
> > NilClass
>
> >>> puts Foo.find(:all).class
> > Array
>
> > Jeff
>
> --
> 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 
> athttp://groups.google.com/group/rubyonrails-talk?hl=en.

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