In this post I'm continuing refactoring of acts_as_list gem I started in part 1. As you might remember, I've split .acts_as_list method into several modules, each module dedicated to an option passed to the method. E.g. ColumnMethodDefiner module defines methods related to the column option (the option defines column name for storing record's list position). This post is dedicated to refactoring of the ColumnMethodDefiner module. Improving ColumnMethodDefiner module So, I've extracted code related to column option of .acts_as_list to
Tag: singleton method
Today I'm going to refactor acts_as_list Rails library. It allows to treat Rails model records as part of an ordered list and offers methods like #move_to_bottom and #move_higher. Step 1: .acts_as_list introduction .acts_as_list is available as a class method in ActiveRecord::Base when acts_as_list gem is loaded. Here's an excerpt from .acts_as_list definition: Using ClassMethods module is customary in Rails, but it's not a requirement to be familiar with it to read this article. All you need to know is