Sha256: 6952451ff73baeb8acc390a3d96449d9ac9c06960d783848286eb83902c7361e

Contents?: true

Size: 480 Bytes

Versions: 3

Compression:

Stored size: 480 Bytes

Contents

class ContentBlock < ActiveRecord::Base
  MARKETING  = 'marketing_text'.freeze
  RESEARCHER = 'featured_researcher'.freeze
  ANNOUNCEMENT = 'announcement_text'.freeze

  def self.recent_researchers
    where(name: RESEARCHER).order('created_at DESC')
  end

  def self.featured_researcher
    recent_researchers.first
  end

  def self.external_keys
    { RESEARCHER => 'User' }
  end

  def external_key_name
    self.class.external_keys.fetch(name) { 'External Key' }
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sufia-6.7.0 app/models/content_block.rb
sufia-6.6.1 app/models/content_block.rb
sufia-6.6.0 app/models/content_block.rb