草庐IT

raise_not_found_error

全部标签

ruby-on-rails - 为什么我会出现间歇性的 Excon::Error::Socket: getaddrinfo: No address associated with hostname (SocketError)?

Rails4-Ruby2.2.2-亚马逊AWSS3-蜻蜓1.0.12-dragonfly-s3_data_store1.2-fog-aws0.10.0大约99%的时间我们没有问题。这个问题通常只发生在使用率很高的时候,但我注意到它也发生在几乎没有用户的时候。抛出错误的行:#excon/lib/excon/socket.rb#line100insidetheconnectionmethod.addrinfo=::Socket.getaddrinfo(*args)该错误在应用程序中无处不在。有时在没有远程连接时会出现错误。-我无法再验证这一点。我使用Rails记录器来捕获传入的参数,通过和

ruby - 总和(&:x) not working any more

我在我的Rails应用程序(4.1.2)中使用payments.sum(&:price)。自从我从Ruby1.9.3更新到2.1.2后,出现了以下错误:wrongnumberofarguments(1for2..3)这些变体有效:payments.map(&:price).sumpayments.to_a.sum(&:price)我必须重写我的代码还是我遗漏了什么?谢谢! 最佳答案 来自documentation:sum(*args)Calculatesthesumofvaluesonagivencolumn.Thevalueisr

ruby-on-rails - rbenv : version `2.0.0' is not installed

我正在尝试使用Bundleinstall安装Gemfile内容,但出现错误rbenv:version`2.0.0'isnotinstalled我系统安装的ruby版本是:ruby2.1.2p95(2014-05-08revision45877)[i686-linux]和rbenv2.1.2(setby/home/jay/.rbenv/version)2.1.3Gemfile需要ruby"2.0.0"。谁能告诉我如何在不影响现有版本的情况下安装所需的版本。 最佳答案 您可以在这里找到很多信息:rbenvongithub列出所有可用的安

ruby - 什么是 Ruby 中的 "Syntax Error, unexpected tCONSTANT"错误?

我目前正在学习“艰难地学习Ruby”的第9课。我已经完全按照指示输入了第6行,但在执行时仍然出现错误。它说:Syntaxerror,unexpectedtCONSTANT,expecting$endputs"Here^arethedays:",days 最佳答案 您忘记关闭前一行的字符串。这是重现的问题:paul@paulbookpro~⸩rubydays="abcputs"Herearethedays"-:2:syntaxerror,unexpectedtCONSTANT,expecting$endputs"Herearethed

ruby-on-rails - 特拉维斯 CI : FATAL: role does not exist

我正在尝试让我的应用程序与TravisCI一起工作,但我不断收到:FATAL:role"skateparks"doesnotexist。关于我可能做错了什么的任何想法?我关注了他们的documentation. 最佳答案 作为记录,在您的.travis.yml中放入类似这样的内容:before_script:-psql-c"CREATEUSERskateparksWITHPASSWORD'skateparks';"-Upostgres 关于ruby-on-rails-特拉维斯CI:FAT

Ruby 最佳实践 : if not empty each do else in one operator

1.我找不到一种优雅的方式来编写这段代码:ifarray.empty?#processemptyarrayelsearray.eachdo|el|#processelendend我想要一个循环,而不用写两次array。我读了this,但没有足够好的解决方案。2。我实际上在HAML模板中。同样的问题。-ifarray.empty?%pNoresult-else%ul-array.eachdo|el|%liel 最佳答案 怎么样?array.eachdo|x|#...puts"x",xend.empty?andbeginputs"emp

ruby-on-rails - bundle 安装 : ERROR: Failed to build gem native extension. nio4r gem

我目前正在使用以下项目进行项目:rvm1.26.11ruby2.2.1p85我尝试运行bundleinstall但不断收到以下错误:Gem::Ext::BuildError:ERROR:Failedtobuildgemnativeextension.并且,以下:Anerroroccurredwhileinstallingnio4r(1.0.0),andBundlercannotcontinue.Makesurethat`geminstallnio4r-v'1.0.0'`succeedsbeforebundling.当我尝试运行geminstallnio4r-v'1.0.0'时:Buil

ruby - 获取名称错误 : `format' is not allowed as an instance variable name when testing instance variable with rspec

我有以下测试:let(:client){Descat::Client.new}describe'poblacio'doit'shouldsetformatcorrectly'doclient.poblacio('v1','json','dades')expect(client.instance_variable_get(:format)).toeq('json')endend我有以下正在测试的代码:moduleDescatclassClientBASE_URL='http://api.idescat.cat/'definitialize(attributes={})attributes

ruby - 我在 Mac OS X 上收到 "RVM is not a function"错误,并且没有发布的解决方案有效

我在MacOSx10.8.2(“MountainLion”)上,我成功安装了RVM1.17.8及其依赖项。我可以使用它来使用rvminstall1.9.2安装Ruby版本,但我无法执行rvmuse没有收到此错误:RVMisnotafunction,selectingrubieswith'rvmuse...'willnotwork.Youneedtochangeyourterminalemulatorpreferencestoallowloginshell.Sometimesitisrequiredtouse`/bin/bash--login`asthecommand.Pleasevis

ruby - 错误 : Error installing ffi: ERROR: Failed to build gem native extension

安装了DevKit并重新运行ffi安装…。将其作为输出:C:\DocumentsandSettings\******>geminstallffiTemporarilyenhancingPATHtoincludeDevKit...Buildingnativeextensions.Thiscouldtakeawhile...ERROR:Errorinstallingffi:ERROR:Failedtobuildgemnativeextension.C:/Ruby192/bin/ruby.exeextconf.rbcheckingforffi.h...nocheckingforffi.hin