如何解决Rails 从 5.2.4 更新到 5.2.5 破坏了资产
在部署之前,我运行了 bundle install 和 bundle update。然后我的 Rails 版本从 5.2.4 切换到 5.2.5,并且也升级了几个 gem。一切在开发环境中仍然完美运行。
但是部署到生产环境后出现问题。我有以下问题,我认为这与资产有关。我请求的任何页面,日志文件中都会出现以下消息:
I,[2021-04-22T22:48:43.887632 #7620] INFO -- : Rendered users/index.html.erb within layouts/application (11.6ms)
I,[2021-04-22T22:48:44.149881 #7620] INFO -- : Completed 500 Internal Server Error in 294ms (ActiveRecord: 1.9ms)
F,[2021-04-22T22:48:44.150616 #7620] FATAL -- :
F,[2021-04-22T22:48:44.150738 #7620] FATAL -- : ActionView::Template::Error (application.css):
F,[2021-04-22T22:48:44.150992 #7620] FATAL -- :
9: <title><%= full_title(yield(:title)).html_safe %></title>
10:
11: <link href="/assets/oblique-4.1.1/styles/images/favicon.png" rel="shortcut icon">
12: <%= stylesheet_link_tag "application",media: "all","data-turbolinks-track" => true %>
13: <%= javascript_include_tag "application","data-turbolinks-track" => true %>
14: <%= csrf_Meta_tags %>
15: <%= render "layouts/shim" %>
F,[2021-04-22T22:48:44.151084 #7620] FATAL -- :
F,[2021-04-22T22:48:44.151184 #7620] FATAL -- : app/views/layouts/application.html.erb:12:in `_app_views_layouts_application_html_erb__255798539_93007000'
app/controllers/users_controller.rb:22:in `block (2 levels) in index'
app/controllers/users_controller.rb:21:in `index'
这种情况只发生在生产环境中,其配置由未触及的 production.rb 文件给出:
DataQualityManager::Application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory,allowing both thread web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
config.eager_load = true
# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Enable Rack::Cache to put a simple HTTP cache in front of your application
# Add `rack-cache` to your Gemfile before enabling this.
# For large-scale production use,consider using a caching reverse proxy like Nginx,varnish or squid.
# config.action_dispatch.rack_cache = true
# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
# config.assets.debug = true
# disable Rails's static asset server (Apache or Nginx will already do this).
config.serve_static_assets = true
# Compress JavaScripts and CSS.
config.assets.js_compressor = Uglifier.new(harmony: true)
# config.assets.css_compressor = :sass --> automatically used due to sass-rails gem
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = true
# Generate digests for assets URLs.
config.assets.digest = true
# Version of your assets,change this if you want to expire all your assets.
config.assets.version = '1.0'
# Specifies the header that your server uses for sending files.
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
# config.action_dispatch.x_sendfile_header = 'x-accel-redirect' # for Nginx
# Force all access to the app over SSL,use Strict-Transport-Security,and use secure cookies.
config.force_ssl = false
# Set to :debug to see everything in the log.
config.log_level = :info
# Prepend all log lines with the following tags.
# config.log_tags = [ :subdomain,:uuid ]
# Use a different logger for distributed setups.
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
# Use a different cache store in production.
# config.cache_store = :mem_cache_store
# Enable serving of images,stylesheets,and JavaScripts from an asset server.
# config.action_controller.asset_host = "http://assets.example.com"
# Precompile additional assets.
# application.js,application.css,and all non-JS/CSS in app/assets folder are already added.
config.assets.precompile += %w( search.js )
# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found).
# config.i18n.fallbacks = true
# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify
# disable automatic flushing of the log to improve performance.
# config.autoflush_log = false
# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
# Store uploaded files locally.
config.active_storage.service = :local
# Define connection to email services
config.action_mailer.default_url_options = { :host => 'l021000110029b.adr.admin.ch/' }
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = false
config.action_mailer.default :charset => "utf-8"
end
Gemfile 包含:
source 'https://rubygems.org'
gem 'rails','~> 5.2'
gem 'bootstrap-sass'
gem 'sassc-rails'
gem 'coffee-rails','~> 5.0'
gem 'uglifier','~> 4.0'
gem 'bcrypt','~> 3.1'
gem 'jquery-rails'
gem 'turbolinks','~> 5.2'
gem 'jbuilder','~> 2.6'
gem 'will_paginate','~> 3.1'
gem 'd3-rails'
gem 'js_cookie_rails'
gem 'httparty','~> 0.14'
gem 'nested_form_fields'
gem 'pg'
gem 'deep_cloneable','~> 3.0'
#gem 'acts-as-taggable-on','~> 6.0'
gem 'tzinfo-data'
gem 'audited','~> 4.9'
gem 'awesome_print' # Layout enhancement for Audited
# Generate sql scripts via renderer
gem 'sql_query'
# Workflow support
gem 'workflow-activerecord','>= 4.1','< 6.0'
# Full-text search with Postgres
gem 'pg_search'
# Use Puma as the app server
gem 'puma','~> 5.0'
# XLSX format support
gem 'write_xlsx'
gem 'write_xlsx_rails',git: 'https://github.com/fchampreux/write_xlsx_rails.git',branch: 'master'
gem 'roo'
# Authentication and Authorisations
gem 'devise'
gem 'devise-security'
gem 'email_address' # for email validation
gem 'cancancan','~> 3.0'
# MarkDown parser
gem 'redcarpet','~> 3.5'
# eMail notification support
gem 'mailgun-ruby','~>1.1'
# gem for dev and test only
group :development,:test,:validation do
gem 'annotate','~> 3.0'
gem 'byebug'
gem 'faker'
gem 'shoulda-matchers'
gem 'rails-controller-testing'
gem 'rspec-rails','~> 4.0'
gem 'factory_bot_rails','~> 6.0'
gem 'capybara','~> 3.15'
gem 'database_cleaner-active_record'
gem 'selenium-webdriver','~>3.140'
end
您能帮我了解升级后失败的原因吗? 非常感谢!
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。