Module: FinderMethods

Instance Method Summary collapse

Instance Method Details

#find(*args) ⇒ Object

rubocop: enable CodeReuse/ActiveRecord


16
17
18
# File 'app/finders/concerns/finder_methods.rb', line 16

def find(*args)
  raise_not_found_unless_authorized model.find(*args)
end

#find_by(*args) ⇒ Object

rubocop: disable CodeReuse/ActiveRecord


11
12
13
# File 'app/finders/concerns/finder_methods.rb', line 11

def find_by(*args)
  if_authorized execute.reorder(nil).find_by(*args)
end

#find_by!(*args) ⇒ Object

rubocop: disable CodeReuse/ActiveRecord


5
6
7
# File 'app/finders/concerns/finder_methods.rb', line 5

def find_by!(*args)
  raise_not_found_unless_authorized execute.reorder(nil).find_by!(*args)
end