1

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

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

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'

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

谢谢。

4

1 回答 1

3

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

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

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

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, 并添加您的配置。

希望这可以帮助你。

于 2013-07-22T18:03:39.290 回答