Skip to content

Instantly share code, notes, and snippets.

@eliotsykes
Created December 30, 2015 07:00
Show Gist options
  • Save eliotsykes/41e6aea1f907a2cf04fd to your computer and use it in GitHub Desktop.
Save eliotsykes/41e6aea1f907a2cf04fd to your computer and use it in GitHub Desktop.
Add Custom Scopes to Audited Gem
# app/models/audit.rb
Audit = Audited.audit_class
class Audit
scope :foo, -> { where("created_at > 0") }
scope :bar, -> { where("updated_at > 0") }
end
# Using scopes example:
# Audit.foo.bar
@eliotsykes
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment