Guest User

Untitled

a guest
Oct 22nd, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. class Place < ApplicationRecord
  2. end
  3.  
  4. class SubPlace < Place
  5. has_many :posts, class_name: "SubPlace", foreign_key: "sub_place_id"
  6. end
  7.  
  8. class Post < ApplicationRecord
  9. belongs_to :sub_place, class_name: "SubPlace", foreign_key: "sub_place_id"
  10. end
  11.  
  12. ActiveRecord::StatementInvalid (PG::UndefinedColumn: ERROR: column places.sub_place_id does not exist)
Add Comment
Please, Sign In to add comment