Skip to content

Instantly share code, notes, and snippets.

@ledestin
Last active September 21, 2016 09:14
Show Gist options
  • Save ledestin/de974517ce5dfe42c12af72414664fff to your computer and use it in GitHub Desktop.
Save ledestin/de974517ce5dfe42c12af72414664fff to your computer and use it in GitHub Desktop.
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