Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrating with acts_as_list #7

Closed
npafundi opened this issue Aug 11, 2014 · 2 comments
Closed

Integrating with acts_as_list #7

npafundi opened this issue Aug 11, 2014 · 2 comments

Comments

@npafundi
Copy link
Contributor

Hey Chris,

This is more question/discussion than issue, in case you want to tag as such.

In our application, we're using the acts_as_list gem to organize a few sortable objects. If you're not familiar, acts_as_list essentially handles ordering items based on scope.

acts_as_list writes directly to the given model's table when updating the position column, which (in our case) causes it to bypass draftsman.

I was curious if you had any experience with acts_as_list, and if you had any clever integration methods. I understand the burden isn't really on draftsman -- acts_as_list would probably have to change to allow simple integration. I still thought I'd ask, just in case.

As a note, we may be moving away from acts_as_list, since it's causing a number of other little problems for us. If so, this is totally a non-issue.

Thanks!

@chrisdpeters
Copy link
Collaborator

Draftsman will not handle these types of ActiveRecord callbacks where the database is updated directly without interacting with the model, which is a downfall. I'm finding that drafts make everything harder. :)

In my app, I've had to create a draft_position column and manage it manually through a form object. I also handle publishing through a service object, which sorts out a published position column based on the drafts being published. Once you get a handle on form and service objects, you'll find that they're the best way to get through some of these more complex draft situations.

Another option is to just not record drafts for a sort order column. I know that's probably not a good answer though.

Let me know if you have any specific questions. I'll continue to think about how this gem can be friendlier, but I think this sort of stuff is where ActiveRecord starts to draw criticism.

@npafundi
Copy link
Contributor Author

Thanks Chris, totally makes sense. I think we're going to do something similar with drafts and position. We're still undecided if acts_as_list is helping or hurting us right now, so we might be dropping it in favor of using our own positioning :)

draftsman is pretty friendly already -- I was just curious how you're handling it. If I come up with something different, I'll let you know.

Thanks for the reply!

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

No branches or pull requests

2 participants