2015-07-21 147 views
0

我讓我的應用程序在本地運行。在部署過程中,我得到了幾個問題:在資產期間部署heroku的Activeadmin gem錯誤:預編譯

首先,我裹着爲了部署關係對象,否則部署沒有給出「標籤」表錯誤

if ActiveRecord::Base.connection.table_exists? 'tags' 
    filter :tags_keyword, :as => :check_boxes, :collection => Tag.all.collect {|o| [o.keyword, o.keyword]} 
end 

然後我跑遷移和種子數據庫。但這一次,我沒有任何資產工作,這讓我意識到heroku並沒有在部署過程中編譯資產。

我更新.gitignore來監督清單文件,以便heroku能夠事先編譯資產。但是那個操作給了我下面的錯誤;

remote: -----> Preparing app for Rails asset pipeline 
remote:  Running: rake assets:precompile 
remote:  rake aborted! 
remote:  NoMethodError: undefined method `<<' for true:TrueClass 
remote:  /tmp/build_392c42fc00109fc0ac97d8dd67521707/vendor/bundle/ruby/2.2.0/gems/activeadmin-1.0.0.pre1/lib/active_admin/engine.rb:5:in `block (2 levels) in <class:Engine>' 
remote:  /tmp/build_392c42fc00109fc0ac97d8dd67521707/vendor/bundle/ruby/2.2.0/gems/activeadmin-1.0.0.pre1/lib/active_admin/engine.rb:4:in `each' 
remote:  /tmp/build_392c42fc00109fc0ac97d8dd67521707/vendor/bundle/ruby/2.2.0/gems/activeadmin-1.0.0.pre1/lib/active_admin/engine.rb:4:in `block in <class:Engine>' 
remote:  /tmp/build_392c42fc00109fc0ac97d8dd67521707/vendor/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/initializable.rb:30:in `instance_exec' 
remote:  /tmp/build_392c42fc00109fc0ac97d8dd67521707/vendor/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/initializable.rb:30:in `run' 
remote:  /tmp/build_392c42fc00109fc0ac97d8dd67521707/vendor/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/initializable.rb:55:in `block in run_initializers' 
remote:  /tmp/build_392c42fc00109fc0ac97d8dd67521707/vendor/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/initializable.rb:54:in `run_initializers' 
remote:  /tmp/build_392c42fc00109fc0ac97d8dd67521707/vendor/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/application.rb:352:in `initialize!' 
remote:  /tmp/build_392c42fc00109fc0ac97d8dd67521707/config/environment.rb:5:in `<top (required)>' 
remote:  /tmp/build_392c42fc00109fc0ac97d8dd67521707/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `require' 
remote:  /tmp/build_392c42fc00109fc0ac97d8dd67521707/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `block in require' 
remote:  /tmp/build_392c42fc00109fc0ac97d8dd67521707/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240:in `load_dependency' 
remote:  /tmp/build_392c42fc00109fc0ac97d8dd67521707/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `require' 
remote:  /tmp/build_392c42fc00109fc0ac97d8dd67521707/vendor/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/application.rb:328:in `require_environment! 
remote:  /tmp/build_392c42fc00109fc0ac97d8dd67521707/vendor/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/application.rb:457:in `block in run_tasks_blocks' 
remote:  /tmp/build_392c42fc00109fc0ac97d8dd67521707/vendor/bundle/ruby/2.2.0/gems/sprockets-rails-2.3.2/lib/sprockets/rails/task.rb:64:in `block (2 levels) in define' 
remote:  Tasks: TOP => environment 
remote:  (See full trace by running task with --trace) 
remote: ! 
remote: !  Precompiling assets failed. 
remote: ! 
remote: 
remote: !  Push rejected, failed to compile Ruby app 

這是engine.rb文件錯誤日誌這是AA寶石夾

module ActiveAdmin 
    class Engine < ::Rails::Engine 

    initializer "active_admin.precompile", group: :all do |app| 
     ActiveAdmin.application.stylesheets.each do |path, _| 
     app.config.assets.precompile << path 
     end 
     ActiveAdmin.application.javascripts.each do |path| 
     app.config.assets.precompile << path 
     end 
    end 

    initializer 'active_admin.routes' do 
     require 'active_admin/helpers/routes/url_helpers' 
    end 
    end 
end 

我在Ubuntu 15.04下運行,用紅寶石-v '2.2.2p95',軌道-v '4.2.1',還有一種被困在做什麼的問題。我是一個菜鳥,想知道會有什麼問題?

回答

0

我發現問題是我沒有使用rails_12_factor gem並且在折舊的rails環境變量中玩得太多。經過幾次試驗後,我設法回滾到默認設置,它工作!