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

На ръба си съм с това. Изглежда, че всички по-нови rails приложения, които правя, настройвам няколко конфигурации в 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