質問するログイン新規登録

質問編集履歴

5

前提追記

2020/09/03 11:20

投稿

mofuko
mofuko

スコア13

title CHANGED
File without changes
body CHANGED
@@ -6,7 +6,7 @@
6
6
  Docker
7
7
  docker-compose
8
8
 
9
- GitHub
9
+ GitHubのURLを記載しておきます。
10
10
  [https://github.com/nanakobaby/myapp](https://github.com/nanakobaby/myapp)
11
11
 
12
12
  ## 現状

4

application.jsと同じディレクトリのjsを追記

2020/09/03 11:20

投稿

mofuko
mofuko

スコア13

title CHANGED
File without changes
body CHANGED
@@ -7,7 +7,7 @@
7
7
  docker-compose
8
8
 
9
9
  GitHub
10
- https://github.com/nanakobaby/myapp
10
+ [https://github.com/nanakobaby/myapp](https://github.com/nanakobaby/myapp)
11
11
 
12
12
  ## 現状
13
13
  ローカル上では動作していたjsが、本番環境(AWS)では動作しません。
@@ -89,5 +89,61 @@
89
89
  //= require_tree .
90
90
  ```
91
91
 
92
+ `cable.js`
93
+
94
+ ```
95
+ // Action Cable provides the framework to deal with WebSockets in Rails.
96
+ // You can generate new channels where WebSocket features live using the `rails generate channel` command.
97
+ //
98
+ //= require action_cable
99
+ //= require_self
100
+ //= require_tree ./channels
101
+
102
+ (function() {
103
+ this.App || (this.App = {});
104
+
105
+ App.cable = ActionCable.createConsumer();
106
+
107
+ }).call(this);
108
+ ```
109
+
110
+ `pay.js`
111
+
112
+ ```
113
+ document.addEventListener(
114
+ "DOMContentLoaded", e => {
115
+ if (document.getElementById("token_submit") != null) {
116
+ Payjp.setPublicKey("pk_test_a33b7ef2b25aa51a5df58de1");
117
+ let btn = document.getElementById("token_submit");
118
+ btn.addEventListener("click", e => {
119
+ e.preventDefault();
120
+ let card = {
121
+ number: document.getElementById("card_number").value,
122
+ cvc: document.getElementById("cvc").value,
123
+ exp_month: document.getElementById("exp_month").value,
124
+ exp_year: document.getElementById("exp_year").value
125
+ };
126
+ Payjp.createToken(card, (status, response) => {
127
+ if (status === 200) {
128
+ $("#card_number").removeAttr("name");
129
+ $("#cvc").removeAttr("name");
130
+ $("#exp_month").removeAttr("name");
131
+ $("#exp_year").removeAttr("name");
132
+ $("#card_token").append(
133
+ $('<input type="hidden" name="payjp-token">').val(response.id)
134
+ );
135
+ document.inputForm.submit();
136
+ alert("登録が完了しました");
137
+ } else {
138
+ alert("カード情報が正しくありません。");
139
+ }
140
+ });
141
+ });
142
+ }
143
+ },
144
+ false
145
+ );
146
+ ```
147
+
92
148
  他に対処法はございますでしょうか?
93
149
  この問題に関して、アドバイスいただけると幸いです。宜しくお願い致します????‍♀️

3

GitHub URL追記

2020/09/03 11:19

投稿

mofuko
mofuko

スコア13

title CHANGED
File without changes
body CHANGED
@@ -6,6 +6,9 @@
6
6
  Docker
7
7
  docker-compose
8
8
 
9
+ GitHub
10
+ https://github.com/nanakobaby/myapp
11
+
9
12
  ## 現状
10
13
  ローカル上では動作していたjsが、本番環境(AWS)では動作しません。
11
14
  本番環境で出現しているエラーは以下になります。

2

関連コード追記

2020/09/03 11:00

投稿

mofuko
mofuko

スコア13

title CHANGED
File without changes
body CHANGED
@@ -72,5 +72,19 @@
72
72
  </head>
73
73
  ```
74
74
 
75
+ ## 関連するコード
76
+
77
+ `application.js`
78
+
79
+ ```
80
+ //= require jquery3
81
+ //= require popper
82
+ //= require bootstrap-sprockets
83
+ //= require activestorage
84
+ //= require turbolinks
85
+ //= require rails-ujs
86
+ //= require_tree .
87
+ ```
88
+
75
89
  他に対処法はございますでしょうか?
76
90
  この問題に関して、アドバイスいただけると幸いです。宜しくお願い致します????‍♀️

1

jsファイル内を追記

2020/09/03 10:57

投稿

mofuko
mofuko

スコア13

title CHANGED
File without changes
body CHANGED
@@ -17,6 +17,8 @@
17
17
  エラーが出現している行
18
18
  `myapp/public/assets/application-61cf….`
19
19
 
20
+ ![イメージ説明](0ac72d1ff15ffb6014be69505cbe9f82.jpeg)
21
+
20
22
  ```
21
23
  App.cable=ActionCable.createConsumer()}.call(this),App.loadPlugins=((e,t,n)=>{async function r(){if(t)fo......
22
24
  ```