我正在使用Rails应用程序。我有一个设置下拉列表,它在本地主机上有效,但在heroku上不起作用。请帮助我解决此问题。我尝试了所有可能找到的解决方案,但仍然无法正常工作。我什至尝试对环境文件进行更改,但对我没有任何帮助。
production.rb
config.assets.compile = true
config.serve_static_assets = true
config.assets.digest = true
_navigation.html.erb
<li class="dropdown">
<a href="" data-toggle="dropdown">Settings<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><%= link_to "Change password", changepassword_path %></li>
<% if current_user.superadmin? %>
<li><a href="/main-admin/manage-users">Manage Users</a></li>
<li><a href="/main-admin/general-settings">General Settings</a>
</li>
<% end %>
</ul>
</li>
<% end %>
application.html.erb
<!DOCTYPE html>
<html>
<head>
<title>Freetoplay</title>
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
</head>
<body>
<%= render 'layouts/navigation' %>
<div class="bd">
<div class="container">
<div class="row">
<div class="col-lg-12 col-sm-12 col-xs-12">
<ol class="breadcrumb">
<%= render_breadcrumbs :separator => " / " %>
</ol>
</div>
</div>
</div>
</div>
<%= render 'layouts/messages' %>
<div class="container">
<%= yield %>
</div>
<%= render 'layouts/footer' %>
</body>
</html>
gem文件
gem 'rails', '~> 5.2.0'
gem 'bootstrap-datepicker-rails'
gem 'bcrypt', '~> 3.1.7'
gem 'cocoon'
gem 'webpacker', '~> 3.5.5'
gem 'puma', '~> 3.11'
gem "paperclip", "~> 6.0.0"
gem 'bootstrap-sass', '~> 3.3.7'
gem 'jquery-rails'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'will_paginate', '3.1.5'
gem 'bootstrap-will_paginate', '1.0.0'
gem "breadcrumbs_on_rails"
gem "wysiwyg-rails"
gem "font-awesome-rails"
gem 'filterrific'
gem 'coffee-rails', '~> 4.2'
gem 'turbolinks', '~> 5'
gem 'jbuilder', '~> 2.5'
group :development, :test do
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
gem 'sqlite3'
end
group :production do
gem 'pg'
end
group :development do
gem 'pry'
gem 'pry-nav'
gem 'web-console', '>= 3.3.0'
gem 'listen', '>= 3.0.5', '< 3.2'
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
group :test do
# Adds support for Capybara system testing and selenium driver
gem 'capybara', '>= 2.15', '< 4.0'
gem 'selenium-webdriver'
gem 'chromedriver-helper'
end
答案 0 :(得分:0)
我不知道这是否对您有帮助,但是我总是运行以下命令来更新Heroku的CSS。
RAILS_ENV=production bundle exec rake assets:precompile
git add public/assets
git commit -m "vendor compiled assets"
git push heroku master