I got a class AvatarUploader < Carrierwave::Uploader::Base
which store User
avatars in public/uploads
dir:
def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
version :main do
process :resize_to_limit => [128, 128]
end
And I want to start application in production
mode with assets precompilation enabled. Everything but avatars work fine. When I visit any User
profile I get:
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'
Maybe there is a way to turn off precompilation for avatars(because they could be re-uploaded when app is running on production). Please provide any suggestions how to fix this issue. Thanks.
When image_tag receives a blank string, it tries to get a resource from the asset pipeline and returns
"isn't precompiled"
https://github.com/rails/rails/issues/3080
Print @user.avatar_url(:main).to_s
to double check