Why MyModel.all works in Rails ?

Posted by AntonAL on Stack Overflow See other posts from Stack Overflow or by AntonAL
Published on 2010-05-24T08:03:43Z Indexed on 2010/05/24 8:11 UTC
Read the original article Hit count: 286

Filed under:
|
|

Hi,

i don't understand this little thing:

Suppose, we have "Person" model

class Person < ActiveRecord::Base
end

Why Person.all works ?

Person.all.each { |p| do_something }

This syntax tells us, that we have Person class-object instanciated somewhere ?

Or is it some convention over configuration case ?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about model