rails在开发中没有获得新的图像

时间:2015-12-26 17:46:01

标签: ruby-on-rails

我遇到了一个奇怪的问题。如果我将新图像添加到images文件夹并在网页上使用它 - rails会抛出这样的错误。

    Asset was not declared to be precompiled in production.
Add Rails.application.config.assets.precompile += %w( spinner60.gif ) to config/initializers/assets.rb and restart your server

这一切都只发生在开发模式中。我在本地开发 - 而不是在任何服务器上生产或以其他方式开发。

如果我在本地计算机上重新启动服务器 - rails会获取资产并在没有任何抱怨的情况下提供服务。

以前有人经历过这样的事吗? - 未对任何环境或资产文件进行任何更改。

任何帮助将不胜感激。

asset.rb =  
    # Be sure to restart your server when you modify this file.
    # Version of your assets, change this if you want to expire all your assets.
    # Rails.application.config.assets.version = '1.0'

    # Add additional assets to the asset load path
    # Rails.application.config.assets.paths << Emoji.images_path

    # Precompile additional assets.
    # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
    # Rails.application.config.assets.precompile += %w( search.js )

and development.rb = 

        Rails.application.configure do
  # Settings specified here will take precedence over those in config/application.rb.

  # In the development environment your application's code is reloaded on
  # every request. This slows down response time but is perfect for development
  # since you don't have to restart the web server when you make code changes.
  config.cache_classes = false

  # Do not eager load code on boot.
  config.eager_load = false

  # Show full error reports and disable caching.
  config.consider_all_requests_local       = true
  config.action_controller.perform_caching = false

  # Don't care if the mailer can't send.
  config.action_mailer.raise_delivery_errors = false

  # Print deprecation notices to the Rails logger.
  config.active_support.deprecation = :log

  # Raise an error on page load if there are pending migrations.
  config.active_record.migration_error = :page_load

  # Debug mode disables concatenation and preprocessing of assets.
  # This option may cause significant delays in view rendering with a large
  # number of complex assets.
  config.assets.debug = true

  # Asset digests allow you to set far-future HTTP expiration dates on all assets,
  # yet still be able to expire them through the digest params.
  config.assets.digest = true

  # Adds additional error checking when serving assets at runtime.
  # Checks for improperly declared sprockets dependencies.
  # Raises helpful error messages.
  # config.assets.raise_runtime_errors = true

  # Raises error for missing translations
  # config.action_view.raise_on_missing_translations = true
end

0 个答案:

没有答案