- xml - AJAX/Jquery XML 解析
- 具有多重继承的 XML 模式
- .net - 枚举序列化 Json 与 XML
- XML 简单类型、简单内容、复杂类型、复杂内容
当我尝试预编译我的 Assets 时,出现以下错误。这是具有完整输出的跟踪:
RAILS_ENV=production bundle exec rake assets:precompile --trace
** Invoke assets:precompile (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
rake aborted!
TypeError: can't dup NilClass
/var/lib/gems/2.3.0/gems/redis-activesupport-5.0.3/lib/active_support/cache/redis_store.rb:38:in `dup'
/var/lib/gems/2.3.0/gems/redis-activesupport-5.0.3/lib/active_support/cache/redis_store.rb:38:in `map'
/var/lib/gems/2.3.0/gems/redis-activesupport-5.0.3/lib/active_support/cache/redis_store.rb:38:in `initialize'
/var/lib/gems/2.3.0/gems/activesupport-5.0.5/lib/active_support/cache.rb:60:in `new'
/var/lib/gems/2.3.0/gems/activesupport-5.0.5/lib/active_support/cache.rb:60:in `lookup_store'
/var/lib/gems/2.3.0/gems/railties-5.0.5/lib/rails/application/bootstrap.rb:64:in `block in <module:Bootstrap>'
/var/lib/gems/2.3.0/gems/railties-5.0.5/lib/rails/initializable.rb:30:in `instance_exec'
/var/lib/gems/2.3.0/gems/railties-5.0.5/lib/rails/initializable.rb:30:in `run'
/var/lib/gems/2.3.0/gems/railties-5.0.5/lib/rails/initializable.rb:55:in `block in run_initializers'
/usr/lib/ruby/2.3.0/tsort.rb:228:in `block in tsort_each'
/usr/lib/ruby/2.3.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
/usr/lib/ruby/2.3.0/tsort.rb:431:in `each_strongly_connected_component_from'
/usr/lib/ruby/2.3.0/tsort.rb:349:in `block in each_strongly_connected_component'
/usr/lib/ruby/2.3.0/tsort.rb:347:in `each'
/usr/lib/ruby/2.3.0/tsort.rb:347:in `call'
/usr/lib/ruby/2.3.0/tsort.rb:347:in `each_strongly_connected_component'
/usr/lib/ruby/2.3.0/tsort.rb:226:in `tsort_each'
/usr/lib/ruby/2.3.0/tsort.rb:205:in `tsort_each'
/var/lib/gems/2.3.0/gems/railties-5.0.5/lib/rails/initializable.rb:54:in `run_initializers'
/var/lib/gems/2.3.0/gems/railties-5.0.5/lib/rails/application.rb:352:in `initialize!'
/home/alex/Dev/livingrecipe/config/environment.rb:5:in `<top (required)>'
/var/lib/gems/2.3.0/gems/activesupport-5.0.5/lib/active_support/dependencies.rb:293:in `require'
/var/lib/gems/2.3.0/gems/activesupport-5.0.5/lib/active_support/dependencies.rb:293:in `block in require'
/var/lib/gems/2.3.0/gems/activesupport-5.0.5/lib/active_support/dependencies.rb:259:in `load_dependency'
/var/lib/gems/2.3.0/gems/activesupport-5.0.5/lib/active_support/dependencies.rb:293:in `require'
/var/lib/gems/2.3.0/gems/railties-5.0.5/lib/rails/application.rb:328:in `require_environment!'
/var/lib/gems/2.3.0/gems/railties-5.0.5/lib/rails/application.rb:448:in `block in run_tasks_blocks'
/var/lib/gems/2.3.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `block in execute'
/var/lib/gems/2.3.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `each'
/var/lib/gems/2.3.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `execute'
/var/lib/gems/2.3.0/gems/rake-12.0.0/lib/rake/task.rb:194:in `block in invoke_with_call_chain'
/usr/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
/var/lib/gems/2.3.0/gems/rake-12.0.0/lib/rake/task.rb:187:in `invoke_with_call_chain'
/var/lib/gems/2.3.0/gems/rake-12.0.0/lib/rake/task.rb:180:in `invoke'
/var/lib/gems/2.3.0/gems/sprockets-rails-3.2.0/lib/sprockets/rails/task.rb:62:in `block (2 levels) in define'
/var/lib/gems/2.3.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `block in execute'
/var/lib/gems/2.3.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `each'
/var/lib/gems/2.3.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `execute'
/var/lib/gems/2.3.0/gems/rake-12.0.0/lib/rake/task.rb:194:in `block in invoke_with_call_chain'
/usr/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
/var/lib/gems/2.3.0/gems/rake-12.0.0/lib/rake/task.rb:187:in `invoke_with_call_chain'
/var/lib/gems/2.3.0/gems/rake-12.0.0/lib/rake/task.rb:216:in `block in invoke_prerequisites'
/var/lib/gems/2.3.0/gems/rake-12.0.0/lib/rake/task.rb:214:in `each'
/var/lib/gems/2.3.0/gems/rake-12.0.0/lib/rake/task.rb:214:in `invoke_prerequisites'
/var/lib/gems/2.3.0/gems/rake-12.0.0/lib/rake/task.rb:193:in `block in invoke_with_call_chain'
/usr/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
/var/lib/gems/2.3.0/gems/rake-12.0.0/lib/rake/task.rb:187:in `invoke_with_call_chain'
/var/lib/gems/2.3.0/gems/rake-12.0.0/lib/rake/task.rb:180:in `invoke'
/var/lib/gems/2.3.0/gems/rake-12.0.0/lib/rake/application.rb:152:in `invoke_task'
/var/lib/gems/2.3.0/gems/rake-12.0.0/lib/rake/application.rb:108:in `block (2 levels) in top_level'
/var/lib/gems/2.3.0/gems/rake-12.0.0/lib/rake/application.rb:108:in `each'
/var/lib/gems/2.3.0/gems/rake-12.0.0/lib/rake/application.rb:108:in `block in top_level'
/var/lib/gems/2.3.0/gems/rake-12.0.0/lib/rake/application.rb:117:in `run_with_threads'
/var/lib/gems/2.3.0/gems/rake-12.0.0/lib/rake/application.rb:102:in `top_level'
/var/lib/gems/2.3.0/gems/rake-12.0.0/lib/rake/application.rb:80:in `block in run'
/var/lib/gems/2.3.0/gems/rake-12.0.0/lib/rake/application.rb:178:in `standard_exception_handling'
/var/lib/gems/2.3.0/gems/rake-12.0.0/lib/rake/application.rb:77:in `run'
/var/lib/gems/2.3.0/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
/usr/local/bin/rake:23:in `load'
/usr/local/bin/rake:23:in `<main>'
所以不幸的是我无法弄清楚错误指向哪里,因为没有代码是我的东西,主要是跟踪由默认 gem 中的代码组成。我可以看到我在其中添加的一件事是 Bootstrap gem,但即使我将其取出,也会发生同样的事情。
最佳答案
看起来你的 redis 连接(或设置)不正确
调试它:
1) 在 Rails 控制台中调试 redis 连接。 Using Redis from your application
>> require 'rubygems'
=> false
>> require 'redis'
=> true
>> r = Redis.new
=> #<Redis client v2.2.1 connected to redis://127.0.0.1:6379/0 (Redis v2.3.8)>
>> r.ping
=> "PONG"
>> r.set('foo','bar')
=> "OK"
>> r.get('foo')
=> "bar"
2) 调试 RedisStore
RedisStore.new("localhost:6379/0/cache", expires_in: 90.minutes)
3) 如果命令通过,请按照 gem redis-rails 中的描述为您的应用设置此配置。
# config/application.rb
config.cache_store = :redis_store, "redis://localhost:6379/0/cache", { expires_in: 90.minutes }
4) 稍微尝试一下配置以建立与 redis 的成功连接(并且不要忘记生产中的不同环境配置!!!)
5) 提交更改,重新部署。
关于ruby-on-rails - 无法使用 Assets :precompile 在 rails rake 上复制 NilClass,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45787865/
我正在尝试为应用程序扩展 Ruby 的 NilClass,以便任何方法调用都将返回 nil(实际上是 self,新的扩展 nil)。目的是避免大量额外的 nil 检查逻辑,例如, results =
我正在尝试使用Rails应用程序中的devise来授予对Rack中间件中的Sinatra应用程序的访问权限。 我的config/routes.rb有: authenticate "admin" do
我使用 dbf gem 从 df 文件中读取数据。我写了一些代码: # encoding: UTF-8 require 'dbf' widgets = DBF::Table.n
我试图避免由于 NilClass 而导致的 NoMethod 错误。我的代码如下所示: @branded, @nonbranded, @unknown, @affiliate, @social, @r
我使用的是 rails 2.3.5 和 ruby 1.8.7。我正在构建一个简单的 TODO 管理器。我有属于用户的任务,而用户有很多任务。 我使用 acts_as_taggable_on_ste
上下文 - 我们有大量的 Chef 属性来执行我们的安装,现在已经为每个环境定义和更改了大约 3000 多个属性。 问题 - 有时 Chef Recipe 会引用不存在的属性 node[:mystuf
我目前使用的是: 20: Status: 但是,我仍然收到以下错误: ActionView::TemplateError (undefined method `status' for
请找到代码的一部分: button = Login_form.button_with(:name => 'Submit') loggedin_page = Login_form.submit(butt
NoMethodError位于/ nil:NilClass的未定义方法`page_media' indexapp/controllers/homepage_controller.rb before
正如我们所知,(几乎)Ruby 中的一切都是一个对象,它是一个类的实例。 nil 也是一个对象: 2.1.3 :016 > nil.object_id => 8 它是 NilClass 的一个实例:
我在 User#index 中有这段代码查看: 返回用户名: user1 user2 user3 ... 然后我将此代码移至 UserHelper : module UserHelper
我的目标是制作一个投票机,将候选人的选票计入总数。最终我想添加写入候选人的选项,但我遇到了这个错误: undefined method 'push' for nil:NilClass) at line
编辑 |或者另一个关于同一 object 主题的问题。我可以编写自己的类定义来使以下所有内容正常工作吗? o = WeirdObject.new puts "Object o evaluates as
这似乎是一个显而易见的问题,但我是新手。我正在尝试抓取 Rotten Tomatoes top 100 movie一个简单的 CLI 应用程序的列表。一切顺利,直到 hero.link 行我得到了 n
感谢您回答我之前的问题,但我遇到了一个新问题。 我正在创建一个自定义验证器,用于验证用户是否输入了干净的单词。这个在我的 UsersController 上用作验证方法。 我正在使用 Obscenit
我现在被这个错误困住了很长一段时间,已经走到了死胡同。 我得到了这个完全无用的错误 can't dup NilClass 情况是这样的。 我有一个类(class)与另一个类(class)有关系。说
我知道这是一百万次,但尝试了一切,我仍然收到此错误: $ rake db:migrate rake aborted! undefined method `accept' for nil:NilClas
Controller def show @dailies = Daily.where(store_id: params[:store]).order(created_at: :asc).by_mo
有人能帮我解决这个错误吗? NoMethodError in Posts#create Showing C:/Users/User/Documents/website/app/views/posts/
我有一个类似于这里的问题的问题,但删除数据库对我的项目来说不是一个可行的解决方案:Rails 5.2 ActiveStorage undefined method `signed_id' for ni
我是一名优秀的程序员,十分优秀!