Class: KB::Breed

Inherits:
BaseModel show all
Includes:
Listable
Defined in:
lib/kb/models/breed.rb

Constant Summary collapse

DEFAULT_LOCALE =
ENV.fetch('KB_BREEDS_DEFAULT_LOCALE', 'es-es')
STRING_FIELDS =
%i[key locale name species weight_group external_id].freeze
FIELDS =
[*STRING_FIELDS].freeze

Instance Attribute Summary

Attributes inherited from BaseModel

#persisted

Class Method Summary collapse

Methods inherited from BaseModel

#==, define_attribute_methods, define_attributes, #initialize, #persist!, #persisted?

Methods included from Inspectionable

#inspect

Constructor Details

This class inherits a constructor from KB::BaseModel

Class Method Details

.all(filters = {}) ⇒ Object



9
10
11
12
# File 'lib/kb/models/breed.rb', line 9

def self.all(filters = {})
  filters[:locale] ||= DEFAULT_LOCALE
  super(filters)
end

.cats(filters = {}) ⇒ Object



19
20
21
22
# File 'lib/kb/models/breed.rb', line 19

def self.cats(filters = {})
  filters[:species] = 'cat'
  all(filters)
end

.dogs(filters = {}) ⇒ Object



14
15
16
17
# File 'lib/kb/models/breed.rb', line 14

def self.dogs(filters = {})
  filters[:species] = 'dog'
  all(filters)
end