NoMethodError:#<的未定义方法`result' NoMethodError:...>
堆栈跟踪指的是这个地方:
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的生产模型中。我的配置:
开始时似乎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
有人有类似的问题可以帮我提示吗?