我有一个现有的Rails 3.2.14应用程序,我正在尝试添加zurb-foundation。我添加了zurb-foundation gem并运行安装生成器。
我的问题是,每当我尝试加载页面时,都会收到此错误:
couldn't find file 'foundation'
当链轮击中
时//= require foundation
在application.js中的行
问题似乎是来自zurb-foundation gem的资产的目录没有被添加到加载路径中。相比之下,我有一个我最近生成的应用程序,包括从头开始的zurb-foundation,@ asset_paths.asset_environment.paths包含以下内容
"/usr/local/var/rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/jquery-rails-3.0.4/vendor/assets/javascripts",
"/usr/local/var/rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/coffee-rails-3.2.2/lib/assets/javascripts",
"/usr/local/var/rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/zurb-foundation-4.3.0/scss",
"/usr/local/var/rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/zurb-foundation-4.3.0/js"
未包含在我正在更新的应用中的资产加载路径中。相反,我得到了(在better_errors诊断窗口中使用p @ asset_paths.asset_environment.paths)
"/usr/local/var/rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/jquery-ui-rails-4.0.4/app/assets/images",
"/usr/local/var/rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/jquery-ui-rails-4.0.4/app/assets/javascripts",
"/usr/local/var/rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/jquery-ui-rails-4.0.4/app/assets/stylesheets",
"/usr/local/var/rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/jquery-rails-3.0.4/vendor/assets/javascripts",
"/usr/local/var/rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/coffee-rails-3.2.2/lib/assets/javascripts"
有趣的是,如果我在开发模式下运行控制台并查看Rails.application.config.assets.path,它包括:
"/usr/local/var/rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/jquery-ui-rails-4.0.4/app/assets/images",
"/usr/local/var/rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/jquery-ui-rails-4.0.4/app/assets/javascripts",
"/usr/local/var/rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/jquery-ui-rails-4.0.4/app/assets/stylesheets",
"/usr/local/var/rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/jquery-rails-3.0.4/vendor/assets/javascripts",
"/usr/local/var/rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/coffee-rails-3.2.2/lib/assets/javascripts",
"/usr/local/var/rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/zurb-foundation-4.3.1/scss",
"/usr/local/var/rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/zurb-foundation-4.3.1/js"
并且DOES包括zurb-foundation资产路径。
我在资产组,开发组以及任何组之外都包含了gem'zurb-foundation'。我在新的应用程序中使用zurb-foundation-4.3.1。
我的Gemfile资产组是:
group :assets do
gem 'sass-rails'
gem 'coffee-rails'
gem 'uglifier'
gem 'compass-rails'
gem 'zurb-foundation'
end
此问题与Sprockets::FileNotFound with ZURB Foundation类似,尽管Jurriaan未提及资产加载路径。
知道我可能缺少什么吗?
谢谢!
答案 0 :(得分:0)
您是否尝试过重启网络服务器?
更新: 你说它在开发中运行良好,你是否试图耙资产:干净和耙资产:预编译?
答案 1 :(得分:0)
gem是一个问题,它阻止将基础条目添加到load_path。涉及的宝石是mongomapper版本。
通过不加载该gem,问题得以解决。通过添加gem返回,问题再次出现。
宝石两年没有任何活动。我想是时候找别的了。