take-five / activerecord-hierarchical_query

Simple DSL for creating recursive queries with ActiveRecord

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Column name 'parent' replaces automatically to 'parent_id'

green-ghost opened this issue · comments

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) }

Error:
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?

I'm closing this issue due to lack of followup.