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



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

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

#find_by!(arg) ⇒ Object

Raises:



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

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



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

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