- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我随机收到以下错误消息。有谁知道可能导致这种情况的原因吗?
NoMethodError (undefined method `slice!' for nil:NilClass):
vendor/bundle/ruby/2.1.0/gems/redis-3.2.1/lib/redis/connection/ruby.rb:274:in `read'
vendor/bundle/ruby/2.1.0/gems/redis-3.2.1/lib/redis/client.rb:248:in `block in read'
vendor/bundle/ruby/2.1.0/gems/redis-3.2.1/lib/redis/client.rb:236:in `io'
vendor/bundle/ruby/2.1.0/gems/redis-3.2.1/lib/redis/client.rb:247:in `read'
vendor/bundle/ruby/2.1.0/gems/redis-3.2.1/lib/redis/client.rb:112:in `block in call'
vendor/bundle/ruby/2.1.0/gems/redis-3.2.1/lib/redis/client.rb:217:in `block (2 levels) in process'
vendor/bundle/ruby/2.1.0/gems/redis-3.2.1/lib/redis/client.rb:353:in `ensure_connected'
vendor/bundle/ruby/2.1.0/gems/redis-3.2.1/lib/redis/client.rb:207:in `block in process'
vendor/bundle/ruby/2.1.0/gems/redis-3.2.1/lib/redis/client.rb:292:in `logging'
vendor/bundle/ruby/2.1.0/gems/redis-3.2.1/lib/redis/client.rb:206:in `process'
vendor/bundle/ruby/2.1.0/gems/redis-3.2.1/lib/redis/client.rb:112:in `call'
vendor/bundle/ruby/2.1.0/gems/redis-3.2.1/lib/redis.rb:789:in `block in get'
vendor/bundle/ruby/2.1.0/gems/redis-3.2.1/lib/redis.rb:37:in `block in synchronize'
/usr/local/ruby-2.1.5/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
vendor/bundle/ruby/2.1.0/gems/redis-3.2.1/lib/redis.rb:37:in `synchronize'
vendor/bundle/ruby/2.1.0/gems/redis-3.2.1/lib/redis.rb:788:in `get'
vendor/bundle/ruby/2.1.0/gems/redis-store-1.1.4/lib/redis/store/interface.rb:5:in `get'
vendor/bundle/ruby/2.1.0/gems/redis-store-1.1.4/lib/redis/store/marshalling.rb:17:in `get'
vendor/bundle/ruby/2.1.0/gems/redis-activesupport-4.0.0/lib/active_support/cache/redis_store.rb:169:in `read_entry'
vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.9/lib/active_support/cache.rb:312:in `block in read'
vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.9/lib/active_support/cache.rb:548:in `instrument'
vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.9/lib/active_support/cache.rb:311:in `read'
/var/www/apps/13712/shared/vendor_bundle/ruby/2.1.0/bundler/gems/spree-13f1df56d58f/core/app/models/spree/preferences/store.rb:34:in `get'
/var/www/apps/13712/shared/vendor_bundle/ruby/2.1.0/bundler/gems/spree-13f1df56d58f/core/app/models/spree/preferences/scoped_store.rb:13:in `fetch'
/var/www/apps/13712/shared/vendor_bundle/ruby/2.1.0/bundler/gems/spree-13f1df56d58f/core/app/models/spree/preferences/preferable_class_methods.rb:13:in `block in preference'
/var/www/apps/13712/shared/vendor_bundle/ruby/2.1.0/bundler/gems/spree-13f1df56d58f/core/app/models/spree/preferences/preferable.rb:43:in `get_preference'
vendor/bundle/ruby/2.1.0/bundler/gems/spree-13f1df56d58f/core/lib/spree/core/controller_helpers/ssl.rb:8:in `block (2 levels) in <module:SSL>'
last place Spree 在调用 redis-rb 之前被命中:
unless (val = @cache.read(key)).nil?
return val
end
哪里 @cache = Rails.cache
更新
我将此 gem 与此 SSL plugin 一起使用,所以错误可能与插件有关。
错误发生在 line = @sock.gets
为 nil
时。这是本地人在确定是真的之后。
[1] pry(#<Redis::Connection::Ruby>)> line
=> nil
[2] pry(#<Redis::Connection::Ruby>)> @sock
=> #<OpenSSL::SSL::SSLSocket:0x007fdab2688730
@callback_state=nil,
@context=
#<OpenSSL::SSL::SSLContext:0x007fdab2688758
@ca_file=nil,
@ca_path=nil,
@cert=nil,
@cert_store=nil,
@client_ca=nil,
@client_cert_cb=nil,
@extra_chain_cert=nil,
@key=nil,
@npn_protocols=nil,
@npn_select_cb=nil,
@options=nil,
@renegotiation_cb=nil,
@servername_cb=nil,
@session_get_cb=nil,
@session_id_context=nil,
@session_new_cb=nil,
@session_remove_cb=nil,
@timeout=nil,
@tmp_dh_callback=nil,
@verify_callback=nil,
@verify_depth=nil,
@verify_mode=nil>,
@eof=true,
@hostname=nil,
@io=#<Redis::Connection::TCPSocket:fd 11>,
@rbuffer="",
@sync=true,
@sync_close=false,
@wbuffer="">
[3] pry(#<Redis::Connection::Ruby>)> @sock.closed?
=> false
最佳答案
这看起来可能是 ruby redis 客户端的问题。
您可以尝试降级版本和/或为 redis 团队提交问题 in the Github repository .
关于ruby - NoMethodError(未定义方法 `slice!' 为 nil :NilClass) from Redis call,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30358664/
上下文: 我从存储库中提取了最新的代码,并尝试确保我将要推送的更改能够与该版本的代码一起使用。这是一个 Ruby on Rails 应用程序。另外值得注意的是,在运行我从网络上提取的主应用程序时,不会
让我们考虑以下代码: class Try CONST = xxx("42") private_class_method def self.xxx(str) str.to_i end end
我一直在寻找解决方案,但最相关的答案似乎规定使用 self. ,我已经在做;我无法用我可以找到我做错了什么的方式来表达我的搜索。我正在定义一个类,如下所示,但是当我尝试创建一个实例时,我得到了 NoM
我向 String 类添加了一个额外的方法。我想稍后使用此方法,但出现 no Method 错误。 class String def as_file_full_path NSSear
我尝试使用 ruby on Rails 请求数据库中的日期时间条目。这在 Linux 环境中工作得很好,但在我的 Windows 环境中我得到了 NoMethodError。调试时,我发现将日期时
我正在努力学习 ruby。我卡在第 26 课了。Here是文件的链接。这是错误所在的代码片段: five = 10 - 2 + 3 - 6 puts "This should be five: #
我不想在某个地方引发 NoMethodError 而只是针对某个类(例如 NilClass)。 例如 begin maybe_nil_maybe_not_nil = nil maybe_nil
我有一个正在编写的 sinatra 应用程序。我正在尝试编写一个页面来显示存储在数据库中的各个模式。使用 datamapper 我创建了一个类: require 'dm-core' require '
不确定是否有很多人熟悉 Ruby 的脚手架扩展,但我查看了他们的文档、论坛,甚至 Heroku 测试站点的源代码,但没有找到答案。 我制作了一个基本的 Sinatra 应用程序并按照 RDoc 的说明
我正在创建一个 Die 类,它具有输出骰子编号的功能。它已被命名为 printout 和 output,但由于 NoMethodError,函数继续失败。这是我的代码: class Die def
Whole source code here 我觉得我的程序流程有逻辑错误,返回NoMethodError 首先,一段导致错误的代码。 " /> #Error Text NoMethodError a
我正在尝试从我的一个规范助手中的模块访问方法 我将模块包含在测试助手中 module Support class RestHelper include Rest::Rest def
我在学习 Ruby 的时候正在做一个简单的 Pi Generator,但是我在 RubyMine 6.3.3 上一直遇到 NoMethodError,所以我决定用尽可能简单的方式创建一个新项目和新类,
我有一个这样的模块: module Prober def probe_invoke(type, data = {}) p = Probe.new({:probe_type => type.
我有一个 ruby 程序,它在特定的命名空间中创建部署、服务和 ing。当我想创建一个命名空间时,它会提示 NoMethodError。 这是代码: namespace = Kubeclient:
context 'with event_type is available create event' do let(:event_type) { EventType.where( name: '
我在 Ruby 中发现了一个奇怪的问题,我不太确定这是一个问题还是最近 Ruby 版本中引入的一个功能。 基本上当我们调用一个未定义的方法时,我们会得到一个 undefined method Ruby
我有以下 Ruby 代码,其中 BigClass 的每个实例创建一个具有 BigClass 实例的数组(直到最大深度)。 class BigClass # Increase this depend
我正在尝试 ror 教程,我遇到了以下代码行: index.html.erb: @players %> _player.html.erb: players_controller.rb: de
当我的 DeltaSynWorker 运行时,我收到 NoMethodErrors。这发生在作为当前工作应用程序的修订版构建的应用程序中。我不是最初的程序员,我是从 Java 背景开始的(我提到这一点
我是一名优秀的程序员,十分优秀!