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