Heroku + Rails 3.2 + PostgreSQL = NoMethodError:#nomethoderror的未定义方法`result':..> </nomethoderror:..>

时间:2013-06-18 14:28:42

标签: ruby-on-rails ruby heroku nomethoderror rails-postgresql

NoMethodError:#&lt;的未定义方法`result' NoMethodError:...&gt;

堆栈跟踪指的是这个地方:

def current_income
  return @current_income if defined? @current_income
  if session[:income_id] && session[:income_id] != nil
    @current_income ||= Income.find session[:income_id] # Line 13 - error place
  else
    create_current_income # Creates new income method
  end
  return @current_income
end

此错误仅在heroku的生产模型中。我的配置:

  • Ruby 2.0.0 + Rails 3.2.13
  • Unicorn服务器+ Postgresql 9.3

开始时似乎Threads和Postgresql连接存在问题,但我已经为ActiveRecord做了所有分支工作人员:

# config/unicorn.rb

worker_processes Integer(ENV['WEB_CONCURRENCY'] || 3)
timeout Integer(ENV['WEB_TIMEOUT'] || 15)
preload_app true

before_fork do |server, worker|

  Signal.trap 'TERM' do
    puts 'Unicorn master intercepting TERM and sending myself QUIT instead'
    Process.kill 'QUIT', Process.pid
  end

  defined?(ActiveRecord::Base) and
    ActiveRecord::Base.connection.disconnect!
end  

after_fork do |server, worker|

  Signal.trap 'TERM' do
    puts 'Unicorn worker intercepting TERM and doing nothing. Wait for master to sent QUIT'
  end

  defined?(ActiveRecord::Base) and
    ActiveRecord::Base.establish_connection
end

有人有类似的问题可以帮我提示吗?

0 个答案:

没有答案