* Refactoring to consolidate logic Prior to this commit, two controllers had nearly identical chunks of logic. This refactor extracts the logic to a common and more canonical location. * Addressing rubocop's aggressive auto-fix * Adding spat operator for pluck * Renaming method for greater clarity
16 lines
405 B
Ruby
16 lines
405 B
Ruby
class SidebarsController < ApplicationController
|
|
layout false
|
|
before_action :set_cache_control_headers, only: %i[show]
|
|
|
|
def show
|
|
get_latest_campaign_articles
|
|
set_surrogate_key_header "home-sidebar"
|
|
end
|
|
|
|
private
|
|
|
|
def get_latest_campaign_articles
|
|
@campaign_articles_count = Campaign.current.count
|
|
@latest_campaign_articles = Campaign.current.plucked_article_attributes
|
|
end
|
|
end
|