Class: Locomotive::Steam::SiteRepository

Inherits:
Object
  • Object
show all
Includes:
Models::Repository
Defined in:
lib/locomotive/steam/repositories/site_repository.rb

Instance Attribute Summary

Attributes included from Models::Repository

#adapter, #local_conditions, #scope

Instance Method Summary collapse

Methods included from Models::Repository

#base_url, #build, #count, #create, #delete, #find, #first, #i18n_value_of, #inc, #initialize, #initialize_copy, #k, #last, #mapper, #prepare_conditions, #query, #update

Instance Method Details

#by_domain(domain) ⇒ Object



13
14
15
# File 'lib/locomotive/steam/repositories/site_repository.rb', line 13

def by_domain(domain)
  first { where(k(:domains, :in) => [*domain]) }
end

#by_handle_or_domain(handle, domain) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/locomotive/steam/repositories/site_repository.rb', line 17

def by_handle_or_domain(handle, domain)
  if handle.nil?
    by_domain(domain)
  else
    first { where(handle: handle) }
  end
end