docbrown/app/controllers/podcast_episodes_controller.rb
rhymes e588fa7ece Code cleanups (#659)
* Initial automatic cleanup with rubocop

* Fix syntax error introduced by rubocop

* Cleanup seeds file

* Cleanup lib folder

* Exclude bin folder because it contains auto generated files

* Make Rubocop a little bit more chatty

* Block length should not include comments in the count

* Cleanup config folder

* Cleanup specs

* Updated Rubocop version and generated a todo file

* Fix broken ArticlesApi spec

* Fix tests

* Restored rubocop pre-commit hook
2018-08-07 11:00:13 -04:00

29 lines
1,004 B
Ruby

class PodcastEpisodesController < ApplicationController
# No authorization required for entirely public controller
before_action :set_cache_control_headers, only: [:index]
def index
@podcast_index = true
@podcasts = Podcast.order("title asc")
@podcast_episodes = PodcastEpisode.order("published_at desc").first(20)
unless params[:q].present?
set_surrogate_key_header "podcast_episodes_all " + params[:q].to_s, @podcast_episodes.map { |e| e["record_key"] }
end
@featured_story = Article.new
@podcast_index = true
@article_index = true
@list_of = "podcast-episodes"
render template: "articles/index"
end
private
def podcast_episode_params
params.require(:podcast_episode).permit(:title,
:body,
:image,
:social_image,
:remote_social_image_url,
:quote)
end
end