fix lock scope to accept 0 params

refs CNVS-4706

Change-Id: I792e1bd911129bb3164b3972c8fafa25d85b3161
Reviewed-on: https://gerrit.instructure.com/18811
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
This commit is contained in:
Cody Cutrer 2013-03-20 12:28:15 -06:00
parent b838324c8d
commit d68fb99a82
1 changed files with 3 additions and 0 deletions

View File

@ -114,6 +114,9 @@ ActiveRecord::Base.class_eval do
with_exclusive_scope(:find => new_options) { all.map(&column) }
end
end
# support 0 arguments
named_scope :lock, lambda { |*lock| lock = [true] if lock.empty?; {:lock => lock.first} }
end
ActiveRecord::NamedScope::ClassMethods.module_eval do