学生向けプログラミング入門 | 無料

学生向けにプログラミングを無料で解説。Java、C++、Ruby、PHP、データベース、Ruby on Rails, Python, Django

【学習5.0】【Windows】コンパイル

Webページで画像を表示するにはコンパイルする必要があります。


まずはシークレットキーを表示します。


コマンド
rails secret


シークレットキーが表示されるのでコピーします。

C:\WinRails\Gakushuu>rails secret
d151e6c42c09f712157809236fd6676759adb2e3f35ddcb0d5b482ae5c687faf32cb8fd2cf312a03d2c1634a77072031f2c4a6702cd75a52aadf839c86c40068



「config\secrets.yml」の「production」部分にコピーしたシークレットキーを貼り付けます。(22行目)


記述変更 config\secrets.yml

# Be sure to restart your server when you modify this file.

# Your secret key is used for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!

# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
# You can use `rails secret` to generate a secure secret key.

# Make sure the secrets in this file are kept private
# if you're sharing your code publicly.

development:
  secret_key_base: c865468c9c15435f18b204d66f1b55ad26ef210118eab8248d49b361dc8bc4fab5e3d0d50d6e21acf34ec7f000caf5297b15f8880931109e8ab01051fc95a0e6

test:
  secret_key_base: cf1ecc5a796bcefb14b6de47b2e8d34bce130a741604e18202ddc552eb2a44605a6e09f631c4164a77c72ae805844171e12e7ad6a93ac589bffcda47692c58d8

# Do not keep production secrets in the repository,
# instead read values from the environment.
production:
  secret_key_base: d151e6c42c09f712157809236fd6676759adb2e3f35ddcb0d5b482ae5c687faf32cb8fd2cf312a03d2c1634a77072031f2c4a6702cd75a52aadf839c86c40068  
  #secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>



以下のコマンドを実行してコンパイルを行います。


コマンド
rails assets:precompile RAILS_ENV=production


バンドラーの改行コードを変更します。
これをしないとHEROKUデプロイ時にバンドラーのエラーがでます。


「bin\bundle」ファイルを開いて右下の「CRLF」をクリックして改行コードを選択します。

改行コード選択
改行コード選択



上部で改行コード選択ができるので「LF」を選択します。

「LF」を選択
「LF」を選択



上書き保存して「LF」に変更します。

「LF」に変更
「LF」に変更



Gitにコミットします。


ソース管理を選択します。

ソース管理
ソース管理


「+」をクリックして全ての変更をステージします。
全ての変更をステージ
全ての変更をステージ


コミットネームを入力します。
コミットネームを入力
コミットネームを入力


チェックマークをクリックしてコミットします。
チェックマーク
チェックマーク


下部にある同期ボタンをクリックしてGitと同期します。
Gitと同期
Gitと同期

ご自分のGitページを確認して下さい
ご自分のGitページを確認して下さい