Class: CommonRepositoryModel::Area

Inherits:
PersistenceBase show all
Defined in:
lib/common_repository_model/area.rb

Class Method Summary collapse

Methods inherited from PersistenceBase

#active_model_serializer, find

Class Method Details

.find_by_name(name) ⇒ Object



21
22
23
# File 'lib/common_repository_model/area.rb', line 21

def self.find_by_name(name)
  find({'name_s' => name}).first
end

.find_by_name!(name) ⇒ Object



25
26
27
28
29
30
31
32
# File 'lib/common_repository_model/area.rb', line 25

def self.find_by_name!(name)
  find_by_name(name) ||
  raise(
    CommonRepositoryModel::ObjectNotFoundError.new(
      "#{self} with name: #{name.to_s} not found"
    )
  )
end