acts_as_tree icon indicating copy to clipboard operation
acts_as_tree copied to clipboard

Can't Process Ordering on a column named as order

Open cht-wtag opened this issue 4 years ago • 1 comments

if you have a column named as order you can't process FaqLabel.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.

cht-wtag avatar Sep 23 '20 13:09 cht-wtag

Have you tried order: :order instead?

felixbuenemann avatar Sep 23 '20 15:09 felixbuenemann