Sha256: 6b08b4c642edee3ecd0c24e18099b58d7089161c443bca802b4efd0f39688af3

Contents?: true

Size: 560 Bytes

Versions: 2

Compression:

Stored size: 560 Bytes

Contents

module Pwb
  class Content < ApplicationRecord
    has_many :content_photos, dependent: :destroy

    translates :raw, fallbacks_for_empty_translations: true
    globalize_accessors locales: [:en, :ca, :es, :fr, :ar]

    def default_photo_url
      if content_photos.first
        content_photos.first.image_url
      else
        'https://placeholdit.imgix.net/~text?txtsize=38&txt=&w=550&h=300&txttrack=0'
      end
    end

    # def self.get_raw_by_key key
    #   content = Content.find_by_key(key)
    #   content ? content.raw : ""
    # end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pwb-0.0.2 app/models/pwb/content.rb
pwb-0.0.1 app/models/pwb/content.rb