質問編集履歴
1
あああああああああああ
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
あああああああああああああああああああテスト
|
test
CHANGED
@@ -1,69 +1 @@
|
|
1
|
-
###前提・実現したいこと
|
2
|
-
|
3
|
-
railsでお弁当レシピアプリを作成しています。
|
4
|
-
|
5
|
-
|
1
|
+
テストああああああああああああああああああああああああああああああああああああああああ
|
6
|
-
|
7
|
-
解決したい点は、セレクトタグで食材を選択したら、その食材に登録している原価(cost_price)を取得し、ajaxで表示したいです。
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
view/bentos/new
|
12
|
-
|
13
|
-
```
|
14
|
-
|
15
|
-
<%= form_for(@bento) do |f| %>
|
16
|
-
|
17
|
-
<table>
|
18
|
-
|
19
|
-
<thead>
|
20
|
-
|
21
|
-
<tr>
|
22
|
-
|
23
|
-
<th>食材名</th>
|
24
|
-
|
25
|
-
<th>原価</th>
|
26
|
-
|
27
|
-
<th>使用量</th>
|
28
|
-
|
29
|
-
<th>使用価格</th>
|
30
|
-
|
31
|
-
</tr>
|
32
|
-
|
33
|
-
</thead>
|
34
|
-
|
35
|
-
<tbody>
|
36
|
-
|
37
|
-
<tr>
|
38
|
-
|
39
|
-
<%= f.select :material_id, options_from_collection_for_select(Material.all, :id, :name), class: 'searchable' %>
|
40
|
-
|
41
|
-
</tr>
|
42
|
-
|
43
|
-
<tr>
|
44
|
-
|
45
|
-
**ここにどう書いたらいいのでしょうか**
|
46
|
-
|
47
|
-
</tr>
|
48
|
-
|
49
|
-
・
|
50
|
-
|
51
|
-
・
|
52
|
-
|
53
|
-
・
|
54
|
-
|
55
|
-
```
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
▲で食材名(material)を選択して、食材を選択したら、ajaxで原価のカラムの表示が変わるようにしたいです。
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
Materialモデル:id,name,cost_prise
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
どななたかご回答頂けますとうれしいです。
|
68
|
-
|
69
|
-
よろしくお願いいたします。
|