質問編集履歴
2
文法の修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -38,6 +38,58 @@
|
|
38
38
|
|
39
39
|
宜しくお願い致します。
|
40
40
|
|
41
|
+
##(追記)試してみたこと・新たな問題
|
42
|
+
|
43
|
+
上記のエラーを解決する為に city.idを追記
|
44
|
+
|
45
|
+
Controller
|
46
|
+
|
47
|
+
```ruby
|
48
|
+
|
49
|
+
class CitiesController < ApplicationController
|
50
|
+
|
51
|
+
def index
|
52
|
+
|
53
|
+
prefecture = Prefecture.find(params[:prefecture_id])
|
54
|
+
|
55
|
+
cities = prefecture.cities.map do |city|
|
56
|
+
|
57
|
+
{
|
58
|
+
|
59
|
+
id: city.id,
|
60
|
+
|
61
|
+
name: city.name,
|
62
|
+
|
63
|
+
~~path: prefecture_city_areas_path(city)~~
|
64
|
+
|
65
|
+
path: prefecture_city_areas_path(city.id, city)
|
66
|
+
|
67
|
+
}
|
68
|
+
|
69
|
+
end
|
70
|
+
|
71
|
+
render json: cities
|
72
|
+
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
```
|
78
|
+
|
79
|
+
エラーは解消され、親要素から子要素は順調に動いているのですが、
|
80
|
+
|
81
|
+
孫要素に反応がありません。
|
82
|
+
|
83
|
+
console.log($(this).find('option:selected').data().grandchildrenPath);
|
84
|
+
|
85
|
+
undefined となってしまいます。
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
どなたかお分かりになる方いらっしゃいましたらお力添えをお願いいたします。
|
90
|
+
|
91
|
+
|
92
|
+
|
41
93
|
##コード
|
42
94
|
|
43
95
|
view
|
1
誤字の修正です。
test
CHANGED
File without changes
|
test
CHANGED
@@ -30,7 +30,7 @@
|
|
30
30
|
|
31
31
|
|
32
32
|
|
33
|
-
【path: prefecture_city_s
|
33
|
+
【path: prefecture_city_areas_path(city)】
|
34
34
|
|
35
35
|
|
36
36
|
|