Why not login to Qiita and try out its useful features?

We'll deliver articles that match you.

You can read useful information later.

5
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Capistrano + Asset Pipeline + Rails sub app

Posted at

Rails Application をルートではなく、サブディレクトリに複数並べて動作させている場合の設定の仕方。

Rails 側は、環境ごとの設定になるはずなので、environments 側に書く(ここでは、Production)。

production.rb
ENV['RAILS_RELATIVE_URL_ROOT'] = "/hoge"

これだけでもある程度はうまくいくが、Asset を Precompile してできたもの(CSS とか JavaScript とか) に image-url などを利用している場合、そこにサブディレクトリの設定が適用されない。

ここを動作させるためには、deploy.rb を変更する。

deploy.rb
set :asset_env, "RAILS_GROUPS=assets RAILS_RELATIVE_URL_ROOT='/hoge'"
5
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?