-1
我剛剛安裝了elasticsearch,並且所有內容都正確顯示。但爲了讓我的搜索結果成爲一個鏈接,我需要通過SearchController傳遞一個movie_id(該錯誤消息缺少必需的鍵:[:movie_id])我嘗試過很多不同的事情,但沒有運氣。缺少必需的密鑰:但不知道如何找到它
search_controller.rb
class SearchController < ApplicationController
def search
if params[:q].nil?
@movie_genres = []
else
@movie_genres = MovieGenre.where(movie_id: @movie).search params[:q]
end
end
end
search.html.erb
<% @movie_genres.each do |movie_genre| %>
<%= link_to movie_genre.title, movie_movie_genres_path(@movie) %>
<% end %>
任何幫助,您可以提供將不勝感激。
我們可以看到你的堆棧跟蹤? – Geoffroy 2015-01-26 23:35:12
這裏是堆棧跟蹤:app/controllers/search_controller.rb:9:在'search' – user1477529 2015-01-27 00:26:50
這是一個單獨的跟蹤,它指向第9行,在你給我們的代碼中它是空的。也許在你看來@電影是零? – Geoffroy 2015-01-27 00:27:53