Skip to content

Instantly share code, notes, and snippets.

@matthuhiggins
Created May 14, 2009 17:26
Show Gist options
  • Save matthuhiggins/111780 to your computer and use it in GitHub Desktop.
Save matthuhiggins/111780 to your computer and use it in GitHub Desktop.
def named_conditions(name, conditions, &block)
named_scope(name, case conditions
when Hash
{:conditions => conditions}
when Proc
lambda { |*args| {:conditions => conditions.call(*args)} }
end, &block)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment