【问题标题】:zurb foundation 6 on rails 4 works locally but not on dokkuzurbfoundation 6 on rails 4 在本地工作,但不在 dokku
【发布时间】:2016-02-13 16:43:18
【问题描述】:

我有一个带有foundation 6 gem 的rails 应用程序,它在本地渲染得很好,但是一旦我推送到一个dokku 服务器,布局就不会被渲染。

在 chrome devlopper 控制台上,我发现以下错误:

Uncaught ReferenceError: $ is not defined

我的宝石文件

    source 'https://rubygems.org'

gem 'rails_12factor', group: :production

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.4'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

#CMS
gem 'comfortable_mexican_sofa', '~> 1.12.0'
gem 'comfy_blog', '~> 1.12.0'
#foundation
gem 'foundation_rails_helper'
gem 'foundation-rails', github: "zurb/foundation-rails"
gem 'foundation-icons-sass-rails'

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc

# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Unicorn as the app server
gem 'puma'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug'
end

group :production do
    gem 'pg'
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> in views
  gem 'web-console', '~> 2.0'

  # Use sqlite3 as the database for Active Record
  gem 'sqlite3'

  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
end

ruby "2.2.2"

编辑: 我意识到在本地插入了 application.erb.html,但在 dokku 上没有。

【问题讨论】:

    标签: ruby-on-rails zurb-foundation zurb-foundation-6 dokku


    【解决方案1】:

    确保资产已预编译。在生产环境中,'rake assets:precompile' 必须在 rails 服务器启动之前运行。

    【讨论】:

    • 亲爱的gugl,我已经做到了。我现在意识到问题出在其他地方。我正在使用 Comfy Mexican Sofa,并且 SQLite application.html.erb 被正确包含(在开发和生产中),但是一旦我切换到 PostgresQL,情况就不再是这样了,我只剩下我的布局了'已经进入 Comfy。
    猜你喜欢
    • 2015-08-16
    • 2011-10-11
    • 2012-07-17
    • 2021-07-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-08-17
    • 1970-01-01
    相关资源
    最近更新 更多