brendon / acts_as_list

An ActiveRecord plugin for managing lists.

Home Page:http://brendon.github.io/acts_as_list/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Composite primary key support

caseyandgina opened this issue · comments

Can you please add compatibility with https://github.com/composite-primary-keys/composite_primary_keys ?

Currently, this is an example of SQL that ends up being generated when attempting to use the acts_as_list gem with a table with a composite primary key:

UPDATE "feeds"."account_feeds" SET "position" = ("feeds"."account_feeds"."position" + 1) WHERE (1 = 1) AND ("feeds"."account_feeds".account_id,feed_id != 110896047323649606,158) AND ("feeds"."account_feeds"."position" >= 1)

Hi @caseyandgina, I think I've seen Rails integrating composite keys into AR itself in version 7 lately?

Would you be interested in doing up a PR that brings this into Acts As List? I'm a bit short of time to do it myself but an very happy to look at PR's and provide feedback etc... :)

Hi, I likely cannot be of much use coming up with a PR myself as I'm a database adminstrator, not a Ruby developer. But I'll see if a coworker might be willing...

FYI, we moved to Rails 7.1 which has built-in composite primary key support, so no longer care about compatibility with the composite_primary_keys gem. They work slightly differently, which may or may not affect how this gem would interoperate with it.

Hi @caseyandgina, there's an open PR to add this functionality. Just waiting for @caseyandgina to finalise the tests.

This has been implemented and released as 1.2.0.