我让我的应用程序在本地运行。在部署期间,我遇到了几个问题:
首先,我为了部署而包装了关系对象,否则部署没有给出“标签”表错误
-- network protocol: Named Pipes
set quoted_identifier on
set arithabort off
set numeric_roundabort off
set ansi_warnings on
set ansi_padding on
set ansi_nulls on
set concat_null_yields_null on
set cursor_close_on_commit off
set implicit_transactions off
set language us_english
set dateformat mdy
set datefirst 7
set transaction isolation level serializable
然后我运行迁移并播种数据库。但是这一次,我没有资产工作,这让我意识到heroku在部署期间没有编译资产。
我更新了.gitignore以监督清单文件,以便heroku预先编译资产。但是这个操作给了我以下错误;
if ActiveRecord::Base.connection.table_exists? 'tags'
filter :tags_keyword, :as => :check_boxes, :collection => Tag.all.collect {|o| [o.keyword, o.keyword]}
end
这是错误记录在AA gem文件夹
下的engine.rb文件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
我在ubuntu 15.04上运行,使用ruby -v'2.2.2p95',rails -v'4.2.1'并且有点担心该怎么做..我是一个菜鸟并想知道会出现什么问题?
答案 0 :(得分:0)
我发现问题是我没有使用rails_12_factor gem并且使用折旧的rails环境变量玩过多。经过几次试验后,我设法回滚到默认设置,它运作良好!