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

回答編集履歴

3

Add expression

2020/07/24 16:45

投稿

y_shinoda
y_shinoda

スコア3272

answer CHANGED
@@ -21,7 +21,10 @@
21
21
  pool: 15
22
22
  ```
23
23
 
24
+ また、Clear DB と Rails の場合の公式な手順が次の記事に示されています
25
+ [Connecting to ClearDB from Heroku using Ruby on Rails on Cedar – ClearDB](https://w2.cleardb.net/developers/resources/connect-ruby/#1.2)
26
+
24
- また、`encoding` が `unicode` に設定されていないかも確認しましょう
27
+ そして念のため `encoding` が `unicode` に設定されていないかも確認しましょう
25
28
  `encoding` は次のいずれかである必要があります:
26
29
  [MySQL :: MySQL 5.7 Reference Manual :: 10.10 Supported Character Sets and Collations](https://dev.mysql.com/doc/refman/5.7/en/charset-charsets.html)
27
30
 

2

Fix answer

2020/07/24 16:45

投稿

y_shinoda
y_shinoda

スコア3272

answer CHANGED
@@ -1,7 +1,28 @@
1
- Rails `database.yml` 設定で、
1
+ データベース接続を環境変数 `DATABASE_URL` 設定していますか?
2
- 対象の環境に該当する `encoding:` が `unicode` に設定されていることが原因です
3
2
 
3
+ 参考: [Rails Database Connection Behavior | Heroku Dev Center](https://devcenter.heroku.com/articles/rails-database-connection-behavior#configuring-connections-in-rails-4-1)
4
+
5
+ また、上記の記事より、
6
+ Rails の `database.yml` の設定で、Heroku 向けの環境に該当する
7
+ 次の項目は設定することができません。
8
+
9
+ - `adapter`
10
+ - `database`
11
+ - `username`
12
+ - `password`
13
+ - `host`
14
+ - `port`
15
+
16
+ 上記の記事では、次のような、Heroku 向けの環境に該当する項目の設定例が提示されています
17
+
18
+ ```yaml
19
+ production:
20
+ encoding: utf8
21
+ pool: 15
22
+ ```
23
+
24
+ また、`encoding` が `unicode` に設定されていないかも確認しましょう
4
- `encoding:` は次のいずれかである必要があります:
25
+ `encoding` は次のいずれかである必要があります:
5
26
  [MySQL :: MySQL 5.7 Reference Manual :: 10.10 Supported Character Sets and Collations](https://dev.mysql.com/doc/refman/5.7/en/charset-charsets.html)
6
27
 
7
28
  リンクは MySQL 5.7 のためのものです、利用している MySQL のバージョンに注意してください

1

Add expression

2020/07/24 16:40

投稿

y_shinoda
y_shinoda

スコア3272

answer CHANGED
@@ -7,4 +7,12 @@
7
7
  リンクは MySQL 5.7 のためのものです、利用している MySQL のバージョンに注意してください
8
8
 
9
9
  database.yml の詳細については次を参照してください
10
- 参考: [Configuring Rails Applications — Ruby on Rails Guides](https://edgeguides.rubyonrails.org/configuring.html#configuring-a-mysql-or-mariadb-database)
10
+ 参考: [Configuring Rails Applications — Ruby on Rails Guides](https://edgeguides.rubyonrails.org/configuring.html#configuring-a-mysql-or-mariadb-database)
11
+
12
+ ## 原因のログ
13
+
14
+ 次のエラーメッセージです:
15
+
16
+ ```console
17
+ 2020-07-24T14:01:54.746678+00:00 app[web.1]: F, [2020-07-24T14:01:54.746627 #4] FATAL -- : [d417bbc8-6463-49d6-b832-31a8b9a382de] ActionView::Template::Error (Unsupported charset: '"unicode"'):
18
+ ```