I just switched from using the standard “id” column into using my own
primary key and generating my own unique id for each record. But, this
Because my new primary key is not an integer, it breaks the SQL query
StatementInvalid in PagesController#create
Mysql::Error: #42S22Unknown column ‘1_3’ in ‘where clause’: SELECT *
FROM pages WHERE (parent_id = 1_3 AND account_id = 1) ORDER BY
position DESC LIMIT 1
Because parent_id is also now a :string column, the 1_3 should be put
into single quotes like so:
SELECT * FROM pages WHERE (parent_id = ‘1_3’ AND account_id = 1)
ORDER BY position DESC LIMIT 1
… but acts_as_tree assumes that the default parent_id column should
be an integer.
Any ideas on how I can get Rails to treat that parent_id as a string
instead of an integer?