资产未在生产模式下加载

时间:2014-09-10 09:36:25

标签: ruby-on-rails heroku devise assets production

Hello stackoverflow社区,

我正在构建一个使用devise进行身份验证的Rails应用程序,它在开发模式下工作正常。当我在Heroku上托管应用程序时,一切正常,但是问题旁边的Checkbox保存了密码。

我正在使用基于Twitter Bootstrap的Metronic Admin主题。

这是未在生产模式中显示的复选框。

  .form-actions
    .checkbox
      = f.check_box :remember_me
      = f.label :remember_me, 'Passwort merken'

这是我的production.rb文件

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

  # Code is not reloaded between requests.
  config.cache_classes = true

  # Eager load code on boot. This eager loads most of Rails and
  # your application in memory, allowing both threaded web servers
  # and those relying on copy on write to perform better.
  # Rake tasks automatically ignore this option for performance.
  config.eager_load = true

  # Full error reports are disabled and caching is turned on.
  config.consider_all_requests_local       = false
  config.action_controller.perform_caching = true

  # Disable Rails's static asset server (Apache or nginx will already do this)
  # --> nope, enabled it because we dont have no nginx!
  config.serve_static_assets = true

  # Compress JavaScripts and CSS
  config.assets.compress = true
  config.assets.js_compressor  = :uglifier
  config.assets.css_compressor = :sass

  # Don't fallback to assets pipeline if a precompiled asset is missed
  config.assets.compile = false

  # change this if you want to expire all your assets
  config.assets.version = '1.0'
  # Generate digests for assets URLs
  config.assets.digest = true

  # Specifies the header that your server uses for sending files.
  # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
  config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx

  # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
  config.force_ssl = ENV['HTTPS'].to_bool

  # Set to :debug to see everything in the log.
  config.log_level = :info

  # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
  # the I18n.default_locale when a translation can not be found)
  config.i18n.fallbacks = true

  # Send deprecation notices to registered listeners.
  config.active_support.deprecation = :notify

  # Disable automatic flushing of the log to improve performance.
  config.autoflush_log = false

  # Use default logging formatter so that PID and timestamp are not suppressed.
  config.log_formatter = ::Logger::Formatter.new

  # Do not dump schema after migrations.
  config.active_record.dump_schema_after_migration = false

  #Set timezone
  config.time_zone = 'Bern'

  # google analytics
  GA.tracker = ENV['GA_TRACKER']

  # mailers
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.raise_delivery_errors = false
  config.action_mailer.perform_deliveries = true
  config.action_mailer.smtp_settings = {
    address:              ENV['SMPT_HOST'],
    port:                 ENV['SMPT_PORT'].to_i,
    domain:               ENV['SMPT_DOMAIN'],
    user_name:            ENV['SMPT_USER'],
    password:             ENV['SMPT_PASS'],
    authentication:       :plain,
    enable_starttls_auto: true
  }


  # default host for mailer and controllers
  default_url_options = {
    host: ENV['HOST_FOR_LINKS'], protocol: config.force_ssl ? 'https://' : 'http://'
  }
  config.action_mailer.default_url_options = default_url_options
  routes.default_url_options = default_url_options
end

和我的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

  # 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

  # strong_parameters: raise exception
  config.action_controller.action_on_unpermitted_parameters = :raise

  # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
  config.force_ssl = ENV['HTTPS'].to_bool

  # mailcatcher
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.smtp_settings = { address: "localhost", port: 1025 }

  #Set timezone
  config.time_zone = 'Bern'

  # default host for mailer and controllers
  default_url_options = {
    host: ENV['HOST_FOR_LINKS'], protocol: config.force_ssl ? 'https://' : 'http://'
  }
  config.action_mailer.default_url_options = default_url_options
  routes.default_url_options = default_url_options

  # Live reload for debugging
  if ENV['LIVE_RELOAD'].to_bool
    config.middleware.use Rack::LiveReload
  end
end

0 个答案:

没有答案