Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

acts_as_list does not play well with PostgreSQL and string scope name #19

Open
tb opened this issue Feb 3, 2013 · 2 comments
Open

acts_as_list does not play well with PostgreSQL and string scope name #19

tb opened this issue Feb 3, 2013 · 2 comments

Comments

@tb
Copy link

tb commented Feb 3, 2013

PostgreSQL does not work with:
acts_as_list :scope => 'article_section_id', :column => 'sort_order'

When I run:
ArticleSection.find(1234).articles.create(title: "Test1")

It results in following error: ActiveRecord::StatementInvalid: PG::Error: ERROR: argument of WHERE must be type boolean, not type integer

because this SQL being executed:
SELECT "articles".* FROM "articles" WHERE (article_section_id) ORDER BY articles.sort_order DESC LIMIT 1

I was able to fix it basded on very old blog post: http://www.mattmccray.com/archive/2006/07/19/Comatose_and_PostgreSQL

All that I had to do was to change string names to symbols:
acts_as_list scope: :article_section_id, column: :sort_order

I report it since it looks like bug to me.

@philippfranke
Copy link

Hey @tb, the official repository moved to https://github.com/swanandp/acts_as_list. Please check if your issue is solved.

@xarisd
Copy link

xarisd commented Mar 6, 2014

Hello there I tried to find the issues in the new "official" repository https://github.com/swanandp/acts_as_list but I didn't find any similar issue.
I am having the same problem (acts_as_list 0.4.0) when I publish to Heroku.
Is there anyone who knows how to fix this?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants