many to one relationship postgresql code example
Example: rails many to many relationship same model
class PageAssociation < ActiveRecord::Base
belongs_to :left_page, :class_name => 'Page'
belongs_to :right_page, :class_name => 'Page'
end
class PageAssociation < ActiveRecord::Base
belongs_to :left_page, :class_name => 'Page'
belongs_to :right_page, :class_name => 'Page'
end