Skip to content

Instantly share code, notes, and snippets.

@ScotterC
Forked from lperichon/gist:836107
Created February 21, 2011 17:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ScotterC/837399 to your computer and use it in GitHub Desktop.
Save ScotterC/837399 to your computer and use it in GitHub Desktop.
module Searchlogic
module NamedScopes
# Handles dynamically creating named scopes for ordering by columns. Example:
#
# User.ascend_by_id
# User.descend_by_username
#
# See the README for a more detailed explanation.
module Ordering
module InstanceOverrideMethods
def order(*args)
begin
if condition?(args[0])
send(args[0])
else
super
end
rescue
Rails.logger.debug "Rescued!"
end
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment