Closed green-ghost closed 5 years ago
Schema:
create_table "products", force: :cascade do |t| t.string "title" t.text "description" t.integer "parent" #Foreign key t.boolean "leaf" end
code: Product.join_recursive { start_with(parent: nil).connect_by(id: :parent).order_siblings(:title) }
Product.join_recursive { start_with(parent: nil).connect_by(id: :parent).order_siblings(:title) }
Error: PG::UndefinedColumn: ERROR: column products.parent_id does not exist
PG::UndefinedColumn: ERROR: column products.parent_id does not exist
hi @green-ghost
Could you also show me your Product model definition and erroneous SQL query?
Product
I'm closing this issue due to lack of followup.
Schema:
code:
Product.join_recursive { start_with(parent: nil).connect_by(id: :parent).order_siblings(:title) }
Error:
PG::UndefinedColumn: ERROR: column products.parent_id does not exist