diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index dc947f3f..b84e458f 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -40,12 +40,12 @@ def home :all end @scores = @user.scores.send(order) # ソート結果格納 - elsif params[:input_value] == :name || params[:input_value] == :composer || params[:input_value] == :arranger - @search_params = score_search_params - @scores = score_search(@search_params) + elsif !params[:input_value].nil? + @search_params = score_search_params # score_search_paramsは検索ボックスの入力値取得メソッド + @scores = Score.score_search(@search_params)# score_serchによりDBから内容取得 elsif !params[:use_gakki].nil? @search_params = score_search_gakki_params - @scores = score_search_gakki(@search_params) + @scores = Score.score_search_gakki(@search_params) else @scores = @user.scores.all end diff --git a/app/views/users/home.html.erb b/app/views/users/home.html.erb index 4709ccd4..1651aeb3 100644 --- a/app/views/users/home.html.erb +++ b/app/views/users/home.html.erb @@ -1,6 +1,26 @@

UsersController#home

+ +

hello

+ <%= form_with model: @score do |form| %> +
+
+ <%= form.label :name, "曲名名検索" %> + <%= form.text_field :name %> +
+
+ <%= form.label :composer, "作曲者検索" %> + <%= form.text_field :composer%> +
+
+ <%= form.label :arranger, "編曲者検索" %> + <%= form.text_field :arranger%> +
+
+ <%= button_to "検索", score_path(form), {class: "search-button"} %> + <% end %> +