Skip to content

Instantly share code, notes, and snippets.

@oelmekki
Created January 8, 2011 20:15
Show Gist options
  • Save oelmekki/771117 to your computer and use it in GitHub Desktop.
Save oelmekki/771117 to your computer and use it in GitHub Desktop.
module Config
# Allows you to scope everything to specific field(s). Works just like validates_uniqueness_of.
# For example, let's say a user belongs to a company, and you want to scope everything to the
# company:
#
# acts_as_authentic do |c|
# c.validations_scope = :company_id
# end
#
# * <tt>Default:</tt> nil
# * <tt>Accepts:</tt> Symbol or Array of symbols
def validations_scope(value = nil)
rw_config(:validations_scope, value)
end
alias_method :validations_scope=, :validations_scope
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment