Last active
September 21, 2016 09:14
-
-
Save ledestin/de974517ce5dfe42c12af72414664fff to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def acts_as_list(column: "position", scope: "1 = 1", top_of_list: 1, add_new_at: :bottom) | |
scope = idify(scope) if scope.is_a?(Symbol) | |
.... | |
end | |
def idify(name) | |
return name.to_sym if name.to_s =~ /_id$/ | |
foreign_key(name).to_sym | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment