Skip to content

Commit

Permalink
[#6] Improve create action readability
Browse files Browse the repository at this point in the history
  • Loading branch information
malparty committed Jun 17, 2021
1 parent 6112c9a commit 4788a17
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions app/controllers/keywords_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@ def create
keyword = params['keyword']
raw_response = GoogleService::ClientService.new(keyword).query_result

return redirect_to keywords_path, alert: I18n.t('keywords.could_not_query') unless raw_response
if raw_response
render :create, locals: {
keyword: keyword,
raw_response: raw_response
}
return
end

render :create, locals: {
keyword: keyword,
raw_response: raw_response
}
redirect_to keywords_path, alert: I18n.t('keywords.could_not_query')
end
end

0 comments on commit 4788a17

Please sign in to comment.