草庐IT

人脸修复

全部标签

ruby - 如何修复意外的 'sudo bundle install dir_name' ?

我不小心运行了sudobundleinstallsmtp_mail,现在我所有的gem都在我的Rails应用程序中这个名为smtp_mail的目录中。我不确定gem的默认位置?而且,我的Rails应用程序在启动时提示。有什么办法可以恢复原状吗? 最佳答案 经过一番谷歌搜索后,我找到了答案只需运行:sudobundleinstall--system然后您会将您的gem放回到它们适当的系统目录中。 关于ruby-如何修复意外的'sudobundleinstalldir_name'?,我们在S

Ruby 动态类。如何修复 "warning: class variable access from toplevel"

我正在尝试编写一个程序,根据从文件中读取的配置动态定义ruby​​类。我知道我可以使用Class.new来做到这一点。这是一个示例程序:x=[1,2,3]Test=Class.newdo@@mylist=xdeffooputs@@mylistendendTest.new.foo当我运行它时,我得到以下输出(使用ruby​​1.9.3p0运行):c:/utils/test.rb:4:warning:classvariableaccessfromtoplevelc:/utils/test.rb:7:warning:classvariableaccessfromtoplevel123Does

ruby - Rails 5 数据库迁移:如何修复 ActiveRecord::ConcurrentMigrationError

之前的rakedb:rollback停滞了。现在,在尝试新的迁移时,我们收到以下错误:rakeaborted!ActiveRecord::ConcurrentMigrationError:Cannotrunmigrationsbecauseanothermigrationprocessiscurrentlyrunning./home/me/.rvm/gems/ruby-2.4.1@global/gems/activerecord-5.1.4/lib/active_record/migration.rb:1315:in`with_advisory_lock'/home/me/.rvm/g

ruby-on-rails - 修复 "ruby installation is missing psych"错误?

我正在运行Rubyruby​​1.9.3p125,但我不断收到此错误,这让我无法在Rails中进行任何类型的开发。Itseemsyourrubyinstallationismissingpsych(forYAMLoutput).Toeliminatethiswarning,pleaseinstalllibyamlandreinstallyourruby.我用Google搜索了一下,似乎尝试了所有方法,但似乎没有任何效果。我真的很想开始一些新项目,但似乎无法绕过这个障碍。非常感谢任何帮助! 最佳答案 我在使用rvm安装ruby​​1.

ruby - 如何修复 Ruby 中挂起的 popen3?

我在使用popen3时遇到意外行为,我想用它来运行类似工具alacmdfile2的命令.下面的示例挂起,因此stdoutdone永远不会达到。使用cat以外的其他工具可能会导致挂起,所以stdindone永远不会达到。我怀疑,我正在遭受缓冲,但我该如何解决这个问题?#!/usr/bin/envrubyrequire'open3'Open3.popen3("cat")do|stdin,stdout,stderr,wait_thr|stdin.puts"foobar"puts"stdindone"stdout.each_line{|line|putsline}puts"stdoutdone

ruby - 如何修复 "Unknown ruby interpreter version (do not know how to handle): RUBY_VERSION."

今天我只想在我的Mac上设置一个jekyll博客,并且已经安装了ruby​​2.3.0,但是当make'$jekyllserve'时,它是错误的。并在终端中显示:错误信息:Unknownrubyinterpreterversion(donotknowhowtohandle):RUBY_VERSION. 最佳答案 看起来像bundleexecjekyllnew将使用以下行创建一个GemfilerubyRUBY_VERSION我相信您会希望将该文件编辑为例如ruby'2.1.1' 关于rub

ruby-on-rails - 如何修复 Mavericks 上 Gemfile 的 libv8 错误?

当我运行bundleinstall时,我得到了Anerroroccurredwhileinstallinglibv8(3.11.8.17),andBundlercannotcontinue.Makesurethat`geminstalllibv8-v'3.11.8.17'`succeedsbeforebundling.Libv8是lunchy和therubyracergems的依赖项。我已经在3.11.8.17上锁定了我的Gemfile.locklibv8gem但是我发现我可以降级到3.3.10.4bundleinstall/update:libv8(therubyracer)inst

ruby-on-rails - 如何修复 Rake 任务中的 "uninitialized constant"

我在做的时候遇到了问题:namespace:xaarondotask:get_rolesdoroles=Xaaron::Role.allputsrolesendtask:get_role,[:name]do|t,args|role=Xaaron::Role.find(args[:name].parameterize)putsroleendend第一个任务可以正常工作。我什至可以添加binding.pry并运行Xaaron::Role并获取有关Roles的信息。但是第二个任务失败了:NameError:uninitializedconstantXaaron::Role我在我的主应用程序中

ruby-on-rails - 如何修复 Rails 中 pg_attribute 表的缓慢隐式查询

在我们的生产环境中,我们注意到Rails应用程序频繁出现峰值(大约每1小时一次)。深入挖掘,这是由于以下查询在单个HTTP请求中累计运行时间超过1.5秒(称为100倍)。SELECTa.attname,format_type(a.atttypid,a.atttypmod),pg_get_expr(d.adbin,d.adrelid),a.attnotnull,a.atttypid,a.atttypmodFROMpg_attributeaLEFTJOINpg_attrdefdONa.attrelid=d.adrelidANDa.attnum=d.adnumWHEREa.attrelid=

ruby - 如何修复 Rubygems 最近的弃用警告?

我最近运行了更新:gemupdate--systemgemupdate现在,每次我加载gem时都会收到很多弃用警告。例如,railsconsole:NOTE:Gem::Specification#default_executable=isdeprecatedwithnoreplacement.Itwillberemovedonorafter2011-10-01.Gem::Specification#default_executable=calledfrom/Users/user/.rvm/gems/ruby-1.9.2-p180@global/specifications/rake-0