Активы Rails 3.2 в производстве

Я в моем остроумии конец с этим. Кажется, все новые приложения для рельсов я делаю, устанавливаю пару конфигураций в environments/production.rb, развертываю и живу дальше. Но теперь мы переносим несколько приложений rails на новый сервер, и кажется, что у всех них возникает эта проблема при развертывании в рабочей среде.

Похоже, что происходит то, что ни мои javascripts, ни таблицы стилей не компилируются. И я не вижу ни одного стиля для приложения и javascript не работает.

config/application.rb:

require File.expand_path('../boot', __FILE__)
require 'rails/all'

if defined?(Bundler)
  Bundler.require(:default, :assets, Rails.env)
end

module MyApp
  class Application < Rails::Application
    ... omitted code ...
    # Enable the asset pipeline
    config.assets.enabled = true

    # Version of your assets, change this if you want to expire all your assets
    config.assets.version = '1.0'


    config.generators.stylesheet_engine = :scss
  end
end

config/environments/production.rb:

MyApp::Application.configure do

  # Code is not reloaded between requests
  config.cache_classes = 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)
  config.serve_static_assets = false

  # Compress JavaScripts and CSS
  config.assets.compress = true

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

  # Generate digests for assets URLs
  config.assets.digest = true

  ... omitted code ...
end

В моем приложении-‹...>.js:

// This is a manifest file that'll be compiled into including all the files listed below.
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
// be included in the compiled file accessible from     http://example.com/assets/application.js
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
//= require jquery
//= require jquery_ujs
//= require_tree
;

А мое приложение-‹...>.css совершенно пустое. Что мне не хватает?


person Sparkmasterflex    schedule 09.06.2014    source источник
comment
в чем проблема? Я предполагаю, что стиль не отражается от разработчика на производственный сервер?   -  person coletrain    schedule 10.06.2014
comment
Эй, у вас есть javascript env, настроенный на вашем новом сервере, чтобы иметь возможность компилировать ваши активы? (например, nodejs). Если нет, добавьте therubyracer в свой Gemfile и проведите тест.   -  person cristian    schedule 10.06.2014
comment
Да, и CSS, и javascript не работают в производстве. Я использую гем therubyracer для активов gem 'execjs', gem 'therubyracer', :platforms => :ruby gem 'libv8', '3.3.10.4'   -  person Sparkmasterflex    schedule 10.06.2014


Ответы (1)


Итак, после долгого полдня вчера и около часа сегодня я вдруг кое-что понял... Я сталкивался с этим раньше.

Конечно... Обновление рельсов до 3.2.14 и повторное развертывание все исправили.

person Sparkmasterflex    schedule 10.06.2014