Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Place < ApplicationRecord
- end
- class SubPlace < Place
- has_many :posts, class_name: "SubPlace", foreign_key: "sub_place_id"
- end
- class Post < ApplicationRecord
- belongs_to :sub_place, class_name: "SubPlace", foreign_key: "sub_place_id"
- end
- ActiveRecord::StatementInvalid (PG::UndefinedColumn: ERROR: column places.sub_place_id does not exist)
Add Comment
Please, Sign In to add comment