Commit 7c061c7d authored by marcheing's avatar marcheing

Extract encoded video search into a private method

parent 90888373
Pipeline #3685517 passed with stage
in 10 minutes and 5 seconds
class ContentsController < ApplicationController
before_action :set_content, only: [:show]
before_action :find_last_encoded_video, only: [:show]
protect_from_forgery with: :null_session, only: :zencoder_callback
# GET /contents/1
# GET /contents/1.json
def show
@encoded_video = @content.encoded_contents.last
redirect_to root_path, notice: I18n.t('video_has_not_finished_encoding') unless @encoded_video.state == 'finished'
@video = @encoded_video.video
end
......@@ -57,4 +56,9 @@ class ContentsController < ApplicationController
def content_params
params.require(:content).permit(:title, :user_id, :adult, :rating, :soundtrack, :view_count, :deleted, :zip_code, :director, :co_director, :team, :allow_comments, :video)
end
def find_last_encoded_video
@encoded_video = @content.encoded_contents.last
redirect_to root_path, notice: I18n.t('video_has_not_finished_encoding') unless @encoded_video.state == 'finished'
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment