私の見解では、
<%= form_tag searches_path, method: 'get', do %>
<p>
<%= text_field_tag :search %>
<%= submit_tag "Search", name: nil %>
</p>
<% end %>
そして私のコントローラーには私が持っている
class SearchesController < ApplicationController
def index
raw_result = params[:search]
result = raw_result.gsub(/\s+/, "+")
movie_details = HTTParty.get("http://imdbapi.org/?title="+result+"&type=json")
@searches = ActiveSupport::JSON.decode(movie_details)
end
end
ビューにアクセスすると、nil:NilClass の未定義メソッド「gsub」が表示されます。フォームが送信されていないため、推測しています。json パーサーを正しく実装していますか?