0
検索フォームを作成しようとしていますが、検索はサードパーティのサイトで行われるため、コントローラだけのモデルはありません。私はRuby on Railsで検索入力を作成する
views/items/index.html.haml
を次のように設定している:
= search_field :search, :search_input
= submit_tag 'Search'
views/items/search.html.haml
:
[email protected] do |item|
%h1= item.title
controllers/items_controller.rb
:
def index
#I am unsure of what to put in here? I think
#I need something wich sends @search_input to my search method
end
def search
@items = some_third_party_search_method_i_wrote{ params[:search_input]}
end
方法1が正しくレールにparams
オブジェクトを使用していますか?検索入力の結果を含むsearch
ページへの検索フォームを含むindex
ページから取得する方法を理解できませんか?