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



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

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

#find_by!(arg) ⇒ Object

Raises:



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

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

#where(arg) ⇒ Object



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

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