为' capistrano-maintenace'配置maintenance_template_path。宝石

时间:2016-09-30 17:30:46

标签: ruby-on-rails-4 capistrano maintenance

capistrano/maintenance gem中,我无法设置:maintenance_template_path变量的路径。

我已经尝试了

# Set the maintenance file path
set :maintenance_template_path, '/views/errors/maintenance'
set :maintenance_template_path, '/errors/maintenance'
set :maintenance_template_path, '/app/views/errors/maintenance'
set :maintenance_template_path, '/errors/maintenance.erb.html'
set :maintenance_template_path, '/views/errors/maintenance.erb.html'
set :maintenance_template_path, 'app/views/errors/maintenance.erb.html'

我一直收到No such file or directory @ rb_sysopen错误。

该文件位于正确的位置/Users/David/Documents/Development/myRailsApp/app/views/errors/maintenance.erb.html

正确的配置是什么?

1 个答案:

答案 0 :(得分:1)

它需要绝对路径。假设您正在使用config/deploy.rb,那么您可以这样做:

set :maintenance_template_path, 
    File.expand_path("../../app/views/errors/maintenance.erb.html", __FILE__)