質問編集履歴

2

コードの追加

2021/09/02 10:07

投稿

Ms_green
Ms_green

スコア0

test CHANGED
File without changes
test CHANGED
@@ -56,7 +56,7 @@
56
56
 
57
57
  ```
58
58
 
59
- ##search_modal.html.erb
59
+ ##_search_modal.html.erb
60
60
 
61
61
  ```
62
62
 
@@ -131,3 +131,25 @@
131
131
  </script>
132
132
 
133
133
  ```
134
+
135
+ ##_search.html.erb
136
+
137
+ ```
138
+
139
+ <div class="text-center mt-5">
140
+
141
+ <%= form_tag({ :controller => 'main', :action => 'top'},{ :method => :get}) do %>
142
+
143
+ <p>
144
+
145
+ <%= text_field_tag :search, params[:search] %>
146
+
147
+ <%= submit_tag "Search", :id => "js-modal-open" %>
148
+
149
+ </p>
150
+
151
+ <% end %>
152
+
153
+ </div>
154
+
155
+ ```

1

table.rbの編集をしました

2021/09/02 10:07

投稿

Ms_green
Ms_green

スコア0

test CHANGED
File without changes
test CHANGED
@@ -28,7 +28,7 @@
28
28
 
29
29
  def self.search(search) #self.でクラスメソッドとしている
30
30
 
31
- Table.where(['languages LIKE ?', "%#{search}%"]).or(where("updated_at LIKE ?", "%#{params}%")).or(where("function LIKE ?", "%#{params}%")).or(where("code LIKE ?", "%#{params}%")).or(where("explanation LIKE ?", "%#{params}%")).or(where("output LIKE ?", "%#{params}%"))
31
+ Table.where(['languages LIKE ?', "%#{search}%"])
32
32
 
33
33
  end
34
34