gpt4 book ai didi

ruby-on-rails - 我们无法运行 "Project Status"或 "Requirement Coverage"报告(模块失败)

转载 作者:行者123 更新时间:2023-12-04 19:44:13 25 4
gpt4 key购买 nike

最近,我们发现在运行某些报告(项目状态或需求覆盖率)时,报告会失败并弹出一个显示:

nil:NilClass 的未定义方法“[]”

检查 httpd 访问日志 我看到以下内容:

“GET/report/requirement_coverage/?sort_by=id&test_object_ids=12 HTTP/1.1”403 38“http://tarantula.xxxxx.xxxx/

在 production.log 文件中,我们还看到:

未定义的方法 []' for nil:NilClass
/opt/tarantula/rails/lib/priority_extensions.rb:9:in
优先名'
/opt/tarantula/rails/app/models/report/requirement_coverage.rb:115:in case_info'
/opt/tarantula/rails/app/models/report/requirement_coverage.rb:77:in
do_query 中的 block (2 级)'
/opt/tarantula/rails/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.18/lib/active_record/associations/collection_proxy.rb:91:in each'
/opt/tarantula/rails/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.18/lib/active_record/associations/collection_proxy.rb:91:in
方法缺失'
/opt/tarantula/rails/app/models/report/requirement_coverage.rb:77:in block in do_query'
/opt/tarantula/rails/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.18/lib/active_record/relation/delegation.rb:6:in
每个'
/opt/tarantula/rails/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.18/lib/active_record/relation/delegation.rb:6:in each'
/opt/tarantula/rails/app/models/report/requirement_coverage.rb:66:in
做查询'

在这下面还有很多:

/opt/tarantula/rails/vendor/bundle/ruby/1.9.1/gems/passenger-3.0.19/helper-scripts/passenger-spawn-server:99:in `'
在 113381.4ms 内完成了 403 Forbidden (Views: 0.2ms | ActiveRecord: 7849.2ms)

注意:这不是我的代码,而是来自 Testia Tarantula 模块的代码

=begin rdoc

Include this in a model which is to be prioritized.

=end
module PriorityExtensions

def priority_name
Project::Priorities.detect{|p| p[:value] == self.priority}[:name]
end

def priority=(p)
if p.is_a? String
p_val = Project::Priorities.detect{|pp| pp[:name] == p.downcase}
if p_val
self[:priority] = p_val[:value]
else
raise "Invalid priority '#{p}' for #{self.class} (id #{self.id})"
end
else
self[:priority] = p
end
end

def self.included(model)
model.validates_inclusion_of :priority, :in => Project::Priorities.map{|p| p[:value]}
end

end

最佳答案

发现问题,“cases”表中的“priority”列以某种方式更改为无效的 NULL。将值更改为“0”(正常)解决了这个问题。

关于ruby-on-rails - 我们无法运行 "Project Status"或 "Requirement Coverage"报告(模块失败),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39105331/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com