0

我有一个 ROR 应用程序,我正在尝试通过加载资产管道来提高性能。

在我正在调用的布局文件中

= stylesheet_link_tag 'users/application_login', :media => "all"

当我在开发中运行它时,它运行完美

ss
=> Booting Thin
=> Rails 3.2.11 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
=> Debugger enabled
>> Thin web server (v1.5.1 codename Straight Razor)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:3000, CTRL+C to stop

但是当我将它作为生产运行时,它告诉我我的资产没有预编译

RAILS_ENV=production rails server
=> Booting Thin
=> Rails 3.2.11 application starting in production on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
>> Thin web server (v1.5.1 codename Straight Razor)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:3000, CTRL+C to stop
Started GET "/users/sign_in" for 127.0.0.1 at 2013-06-25 13:52:18 -0400
Processing by Users::SessionsController#new as HTML
  Rendered users/sessions/new.html.haml within layouts/login (539.8ms)
Completed 500 Internal Server Error in 860ms
** [Airbrake] Success: Net::HTTPOK

ActionView::Template::Error (users/application_login.css isn't precompiled):

我在跑步

RAILS_ENV=production rake assets:precompile

我在/public/assets/users/上看到了一些文件,但没有看到application_login.css

我能做些什么?

4

1 回答 1

4

在 production.rb 中添加:

config.assets.precompile += %w( application_login.css )
于 2013-06-25T18:02:43.910 回答