Skip to content

Commit

Permalink
[#6] Replace instance variables by local variables inside view
Browse files Browse the repository at this point in the history
  • Loading branch information
malparty committed Jun 16, 2021
1 parent a92e863 commit 6a336f9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions app/controllers/keywords_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ class KeywordsController < ApplicationController
def index; end

def create
@keyword = params['keyword']
@raw_response = GoogleService::ClientService.query(@keyword)
keyword = params['keyword']
raw_response = GoogleService::ClientService.query(keyword)

render :create, locals: {
keyword: keyword,
raw_response: raw_response
}
end
end
4 changes: 2 additions & 2 deletions app/views/keywords/create.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<h1>Result for <%= @keyword %></h1>
<h1>Result for <%= keyword %></h1>
<div>
<%= @raw_response.body.html_safe %>
<%= raw_response.body.html_safe %>
</div>

0 comments on commit 6a336f9

Please sign in to comment.