Module: ZendeskAppsSupport::Finders

Included in:
Location, Product
Defined in:
lib/zendesk_apps_support/finders.rb

Defined Under Namespace

Classes: RecordNotFound

Instance Method Summary collapse

Instance Method Details

#find_by(arg) ⇒ Object



9
10
11
# File 'lib/zendesk_apps_support/finders.rb', line 9

def find_by(arg)
  all.find(&filter_by_arg(arg))
end

#find_by!(arg) ⇒ Object



13
14
15
16
17
# File 'lib/zendesk_apps_support/finders.rb', line 13

def find_by!(arg)
  found = find_by(arg)
  fail RecordNotFound.new("Unable to find #{self.name} with #{arg.inspect}") if found.nil?
  found
end

#where(arg) ⇒ Object



19
20
21
# File 'lib/zendesk_apps_support/finders.rb', line 19

def where(arg)
  all.select(&filter_by_arg(arg))
end