Module: PrerenderedEntity

Included in:
ManualChangeHistory, RenderedManual, RenderedSpecialistDocument
Defined in:
app/models/prerendered_entity.rb

Instance Method Summary collapse

Instance Method Details

#create_or_update_by_slug!(attributes) ⇒ Object



2
3
4
5
6
7
8
# File 'app/models/prerendered_entity.rb', line 2

def create_or_update_by_slug!(attributes)
  find_or_initialize_by(
    slug: attributes.fetch(:slug)
  ).tap do |doc|
    doc.update_attributes!(attributes)
  end
end

#find_by_slug(slug) ⇒ Object



10
11
12
# File 'app/models/prerendered_entity.rb', line 10

def find_by_slug(slug)
  where(slug: slug).first
end