I have just started learning ruby on rails and I have encountered code like below:
class Post < ActiveRecord::Base
validates_presence_of :title
belongs_to :user
end
There are two method calls inside the class body. I have had a hard time finding any ruby documentation that describes how method calls from within a body of a class (but outside of any method) work. All the books I have, only describe how to define class and instance methods and how to call them from within other methods.
The questions I have are: How and when are these methods called? How are they defined? Are they mixins defined in some active record module?