Sha256: 33e5da479a458b203f8ae89fe5909873bfd788278d1d514c13a67a7ffb932bc9

Contents?: true

Size: 757 Bytes

Versions: 2

Compression:

Stored size: 757 Bytes

Contents

class PufferPages::Backends::Snippet < ActiveRecord::Base
  include ActiveUUID::UUID
  include PufferPages::Backends::Mixins::Renderable
  include PufferPages::Backends::Mixins::Importable
  include PufferPages::Backends::Mixins::Translatable
  self.abstract_class = true
  self.table_name = :snippets

  attr_protected

  validates_presence_of :name
  validates_uniqueness_of :name

  def self.find_snippet(name)
    where(:name => name).first
  end

  def render *args
    _, context = normalize_render_options *args
    render_template body, context, additional_render_options
  end

  def additional_render_options
    { environment: { processed: self } }
  end

  def i18n_scope
    [:snippets, name.to_sym]
  end

  def i18n_defaults
    []
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
puffer_pages-0.5.1 lib/puffer_pages/backends/models/snippet.rb
puffer_pages-0.5.0 lib/puffer_pages/backends/models/snippet.rb