0

我检查了我heroku logs的,我能看到的唯一给我错误的是

2013-07-04T21:32:14.887388+00:00 app[web.1]: ActionView::Template::Error (gmaps4rails.css isn't precompiled):

然后我得到了几行

2013-07-04T21:32:14.888116+00:00 app[web.1]: Completed 500 Internal Server Error in 767ms

我不确定是什么导致了错误,但如果我解决了这个问题,我可以测试看看我是否仍然收到错误。在我的 confi/application.rb 文件中,我有这个:

config.assets.initialize_on_precompile = false
config.assets.precompile += %w( gmaps4rails.css )
config.assets.compile = true

我不确定是什么导致了错误。

此外,我尝试重新启动我的 heroku 服务器,使用heroku rake db:migrate并仍然遇到相同的错误。

谢谢

编辑:

添加了来自的输出rake assets:precompile --trace

** Invoke assets:precompile (first_time)
** Execute assets:precompile
/Users/andrewliu/.rvm/rubies/ruby-1.9.3-p392/bin/ruby /Users/andrewliu/.rvm/gems/ruby-1.9.3-p392@global/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace
** Invoke assets:precompile:all (first_time)
** Execute assets:precompile:all
** Invoke assets:precompile:primary (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:primary
** Invoke assets:precompile:nondigest (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:nondigest
4

1 回答 1

2

鉴于上面的评论,我认为你应该

  1. 从环境中删除这条线

    config.assets.precompile += %w( gmaps4rails.css )

  2. 从布局中删除此行

    <%= stylesheet_link_tag 'gmaps4rails' %>

  3. 检查applications.css您是否明确包含此文件或require_tree .

因为如果你有gmaps4rails.cssapp/assets/stylesheets那么它应该与其他资产一起预编译。

编辑:解释

真正的问题是什么?两件事情。
首先,您要求 Rails 将文件添加到资产编译中,但仅当文件位于 app/assets 目录之外时才应执行此操作(例如在 gem 中)
其次,在布局中,您想向该文件添加样式表链接,但事实并非如此单独编译,但作为application.css

于 2013-07-05T00:18:42.533 回答