我在目录中有一个class AvatarUploader < Carrierwave::Uploader::Base
哪个商店的User
头像public/uploads
:
def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
version :main do
process :resize_to_limit => [128, 128]
end
我想在production
启用资产预编译的模式下启动应用程序。除了头像之外的一切都很好。当我访问任何User
个人资料时,我会得到:
Started GET "/users/1" for 127.0.0.1 at 2012-05-03 17:45:24 +0300
Processing by Users::UsersController#show as HTML
Parameters: {"id"=>"1"}
Rendered users/users/show.html.erb within layouts/application (2.5ms)
Completed 500 Internal Server Error in 16ms
ActionView::Template::Error ( isn't precompiled):
87: <%= image_tag @user.avatar_url(:main).to_s %>
app/views/users/users/show.html.erb:87:in `_app_views_users_users_show_html_erb___538221278131396366_28399560'
也许有一种方法可以关闭头像的预编译(因为它们可以在应用程序在生产环境中运行时重新上传)。请提供如何解决此问题的任何建议。谢谢。