Class: ContentBlock

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/content_block.rb

Constant Summary collapse

MARKETING =
'marketing_text'
RESEARCHER =
'featured_researcher'
ANNOUNCEMENT =
'announcement_text'

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.external_keysObject



14
15
16
# File 'app/models/content_block.rb', line 14

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


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

def self.featured_researcher
  recent_researchers.first
end

.recent_researchersObject



6
7
8
# File 'app/models/content_block.rb', line 6

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

Instance Method Details

#external_key_nameObject



18
19
20
# File 'app/models/content_block.rb', line 18

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