Q:

where to put to have a method for relationship for has_many? 

class Project
  has_many :pages
end

class Page
  belongs_to :project
end

@project = Project.first
@project.pages.list_out

where should i put to have a method list_out for pages? 

A:

class Project
  has_many :pages

  scope :list_out, joins(:pages).where('pages.project_id = ?',  self.id)
end

class Page
  belongs_to :project
end

@project = Project.first
@project.list_out

