質問編集履歴
2
誤字
title
CHANGED
File without changes
|
body
CHANGED
@@ -20,22 +20,7 @@
|
|
20
20
|
@result= "結果:" + node.xpath('search-result-entry/div/div[2]/div[1]/a/span[1]').text
|
21
21
|
end
|
22
22
|
end
|
23
|
-
```
|
24
23
|
|
25
|
-
```View
|
26
|
-
<h1>Titles</h1>
|
27
|
-
|
28
|
-
<%= form_for(@title) do |f| %>
|
29
|
-
<%= f.label :title, 'タイトル' %>
|
30
|
-
<%= f.text_field :title %>
|
31
|
-
|
32
|
-
<%= f.submit '検索' %>
|
33
|
-
<% end %>
|
34
|
-
|
35
|
-
<%= @result %>
|
36
|
-
|
37
|
-
|
38
|
-
|
39
24
|
def create
|
40
25
|
@title = Title.new(title_params)
|
41
26
|
|
@@ -56,6 +41,23 @@
|
|
56
41
|
end
|
57
42
|
```
|
58
43
|
|
44
|
+
```View
|
45
|
+
<h1>Titles</h1>
|
46
|
+
|
47
|
+
<%= form_for(@title) do |f| %>
|
48
|
+
<%= f.label :title, 'タイトル' %>
|
49
|
+
<%= f.text_field :title %>
|
50
|
+
|
51
|
+
<%= f.submit '検索' %>
|
52
|
+
<% end %>
|
53
|
+
|
54
|
+
<%= @result %>
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
```
|
60
|
+
|
59
61
|
scaffoldで簡易的に作っています
|
60
62
|
|
61
63
|
ウォーキング・デッドのところをユーザーの入力に応じた検索結果を表示したいのですが、どのようにformを使えばいいのかわかりません。
|
1
文房の追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -33,8 +33,31 @@
|
|
33
33
|
<% end %>
|
34
34
|
|
35
35
|
<%= @result %>
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
def create
|
40
|
+
@title = Title.new(title_params)
|
41
|
+
|
42
|
+
respond_to do |format|
|
43
|
+
if @title.save
|
44
|
+
format.html { redirect_to @title, notice: 'Title was successfully created.' }
|
45
|
+
format.json { render :show, status: :created, location: @title }
|
46
|
+
else
|
47
|
+
format.html { render :new }
|
48
|
+
format.json { render json: @title.errors, status: :unprocessable_entity }
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
|
54
|
+
def title_params
|
55
|
+
params.require(:title).permit(:title)
|
56
|
+
end
|
36
57
|
```
|
37
58
|
|
59
|
+
scaffoldで簡易的に作っています
|
60
|
+
|
38
61
|
ウォーキング・デッドのところをユーザーの入力に応じた検索結果を表示したいのですが、どのようにformを使えばいいのかわかりません。
|
39
62
|
|
40
63
|
何卒よろしくお願いいたします!!
|