amerine / acts_as_tree

ActsAsTree -- Extends ActiveRecord to add simple support for organizing items into parent–children relationships.
MIT License
588 stars 88 forks source link

Can't Process Ordering on a column named as order #88

Open cht-wtag opened 4 years ago

cht-wtag commented 4 years ago

if you have a column named as order you can't processFaqLabel.walk_tree for acts_as_tree order: 'order'. I was getting errors like

ActiveRecord::StatementInvalid: PG::SyntaxError: ERROR:  syntax error at or near "order"
LINE 1: ...bels" WHERE "faq_labels"."parent_id" IS NULL  ORDER BY order
                                                                  ^
: SELECT "faq_labels".* FROM "faq_labels" WHERE "faq_labels"."parent_id" IS NULL  ORDER BY order

and I had to rename my column.

felixbuenemann commented 4 years ago

Have you tried order: :order instead?