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

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

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

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


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


コマンド
rails secret


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

MacBook-Pro Gakushuu % rails secret
3fb7769622cd39de87382cc597f27c12deff6b7496c16832f0a11193baf0dd7da35bbc2b1b24229bac35185e4a3bbb9045ad45646faa4ec62c80699c4d29e5e3



「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


Gitにコミットします。


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

ソース管理
ソース管理



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

全ての変更をステージ
全ての変更をステージ



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

コミットネームを入力
コミットネームを入力



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

コミット
コミット



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

Gitと同期
Gitと同期



Gitページの確認

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