take-five / activerecord-hierarchical_query

Simple DSL for creating recursive queries with ActiveRecord
MIT License
119 stars 24 forks source link

Column name 'parent' replaces automatically to 'parent_id' #17

Closed green-ghost closed 5 years ago

green-ghost commented 7 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) }

Error: PG::UndefinedColumn: ERROR: column products.parent_id does not exist

take-five commented 7 years ago

hi @green-ghost

Could you also show me your Product model definition and erroneous SQL query?

zachaysan commented 5 years ago

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