在本地运行mini_magick会返回错误

时间:2013-06-28 17:55:00

标签: ruby-on-rails carrierwave image-uploading uploading minimagick

我是新手,我正在开发一个不是由我开发的网站,我需要在本地运行才能制作一些mod ...

在图片上传过程中,一切正常。添加图像以上载页面重新加载显示在按钮侧面的内容如下:

translation missing: it.errors.messages.mini_magick_processing_error

我知道上传过程是通过carrierwave完成的。 这是运行本地服务器的选项卡上的终端中显示的内容。

ActionController::RoutingError (No route matches [GET] "/assets/uploads/development"):
actionpack (3.2.13) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.13) lib/rails/rack/logger.rb:32:in `call_app'
railties (3.2.13) lib/rails/rack/logger.rb:16:in `block in call'
activesupport (3.2.13) lib/active_support/tagged_logging.rb:22:in `tagged'
railties (3.2.13) lib/rails/rack/logger.rb:16:in `call'
quiet_assets (1.0.2) lib/quiet_assets.rb:18:in `call_with_quiet_assets'
actionpack (3.2.13) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.5) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.5) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.13) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.5) lib/rack/lock.rb:15:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/static.rb:63:in `call'
railties (3.2.13) lib/rails/engine.rb:479:in `call'
railties (3.2.13) lib/rails/application.rb:223:in `call'
rack (1.4.5) lib/rack/content_length.rb:14:in `call'
railties (3.2.13) lib/rails/rack/log_tailer.rb:17:in `call'
rack (1.4.5) lib/rack/handler/webrick.rb:59:in `service'
/Users/luca/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/httpserver.rb:138:in    `service'
/Users/luca/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
/Users/luca/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'

有关如何修复它的任何想法? 我的本地机器上缺少一些宝石或其他宝石?

Thhanks。

1 个答案:

答案 0 :(得分:3)

好的,所以第一个是基于在rails中完成的I18n翻译。如果您查看config/locales目录,则应该有一个it.yml文件。里面应该是

it:
  errors:
    messages:
      mini_magick_processing_error: "some error message in your language"

第二个错误是基于您上传错误或丢失的路线。您应该在config/initializers/carrierwave.rb中使用您的carrierwave配置文件我使用http://fog.io/ gem。这是我的初始化程序的样子。

CarrierWave.configure do |config|
  if Rails.env.test?
    config.storage = :file
    config.enable_processing = false
  else
    config.storage = :fog
    config.fog_credentials = Settings.fog.to_hash.except(:directory)
    config.fog_directory  = Settings.fog.directory
    config.fog_attributes = {'Cache-Control'=>'max-age=315576000'}
    config.asset_host     = "https://#{Settings.fog.directory}.s3.amazonaws.com"
    config.cache_dir      = Rails.root.join('tmp', 'uploads')
  end
end

但是,如果您的上传内容仅存在于您的服务器上,而不是S3或其他外部服务,那么您只需执行config.storage = :file,然后添加您的配置。

希望这可以帮助你。