How can an ActiveRecord::Relation object call class methods?
class Project < ActiveRecord::Base has_many :tasks end class Task < ActiveRecord::Base
Here in ActiveRecord::Relation, Relation is representing whole table and your class Post is map with table,
So ActiveRecord::Relation is array or single record it can access class method.