草庐IT

not_matched

全部标签

ruby -v dyld : Library not loaded:/usr/local/lib/libgmp. 10.dylib

我一直在尝试在终端中运行脚本,每次我都会得到:$rubydirectory.rbdyld:Librarynotloaded:/usr/local/lib/libgmp.10.dylibReferencedfrom:/Users/claretrembath/.rvm/rubies/ruby-2.1.3/bin/rubyReason:imagenotfoundTrace/BPTtrap:5我意识到在检查ruby-v时我得到了相同的输出:$ruby-vdyld:Librarynotloaded:/usr/local/lib/libgmp.10.dylibReferencedfrom:/Use

ruby - Windows 7 中的 "ruby.exe is not recognized as an internal or external command"

我的操作系统是windows7,我正准备将我的本地MySQL数据库连接到Heroku共享数据库,有一次,我得到了libmysql.dll文件丢失的错误,所以我搜索并下载了dll文件并保存它在ruby​​/bin目录中。当我再次连接时,这次它显示错误ruby​​.exe未被识别为内部或外部命令,这就是错误的样子。发送模式'"ruby.exe"'isnotrecognizedasaninternalorexternalcommand,TA:--:--:--operableprogramorbatchfile.'"ruby.exe"'isnotrecognizedasaninternalor

ruby-on-rails - rails "is not a module"错误

我在“lib”rails目录中构建了一个库。库的结构是这样的:lib/insurance/broker/fake_broker.rb该类类似于以下示例:moduleInsurancemoduleBrokerclassFakeBrokerdefinitialize(user_id,user_secret)@user_id=user_id@user_secret=user_secretendendendend因此,在我的result_controller中,我这样做:require'insurance/broker/fake_broker'defshowbroker=Insurance::

ruby-on-rails - Ruby 2.0.0 字符串#Match ArgumentError : invalid byte sequence in UTF-8

我经常看到这种情况,但还没有想出一个优雅的解决方案。如果用户输入包含无效的字节序列,我需要能够让它不引发异常。例如:#@raw_responsecomesfromuserandcontainsinvalidUTF-8#forexample:@raw_response="\xBF"regex.match(@raw_response)ArgumentError:invalidbytesequenceinUTF-8已经问了很多类似的问题,结果似乎是对字符串进行编码或强制编码。然而,这些都不适合我:regex.match(@raw_response.force_encoding("UTF-8"

ruby-on-rails - Rails - bundle : command not found

当我尝试在Mac上运行/检查包时遇到问题当我执行gemlist--local时,Bundler/bundler在本地gem列表中Gemenv返回以下内容RubyGemsEnvironment:-RUBYGEMSVERSION:2.0.14-RUBYVERSION:2.0.0(2014-05-08patchlevel481)[universal.x86_64-darwin14]-INSTALLATIONDIRECTORY:/Library/Ruby/Gems/2.0.0-RUBYEXECUTABLE:/System/Library/Frameworks/Ruby.framework/Ve

ruby 正则表达式 : match and get position(s) of

我想匹配一个正则表达式并获取匹配字符串中的位置例如,"AustinTexasDallasTexas".match_with_posn/(Texas)/我想要match_with_posn返回类似:[6,17]其中6和17是单词Texas的两个实例的起始位置。有这样的吗? 最佳答案 使用Ruby1.8.6+,你可以这样做:require'enumerator'#Onlyfor1.8.6,newerversionsshouldnotneedthis.s="AustinTexasDallasTexas"positions=s.enum_f

ruby-on-rails - 在本地主机 :4567 but not on IP 上运行的 Ruby Sinatra Web 服务

我在Windows732位操作系统上有一个ruby​​(使用sinatra)网络服务。它在端口4567上运行。当我使用localhost:4567时它工作正常但是当我用我机器的本地ip替换localhost时说192.168.103.99:4567它不起作用,并且失败连接。我已经禁用了防火墙,绕过代理并将端口4567添加到异常(exception),仍然没有运气。可能是什么问题? 最佳答案 以下对我有用。rubyapp.rb-o0.0.0.0 关于ruby-on-rails-在本地主机:

ruby - "RVM is not a function"错误

RVM已正确安装在我的机器上(运行MacOSX10.6.8)并且运行良好。奇怪的是,要运行它,我必须为每个新session使用source~/.rvm/scripts/rvm。我尝试从它创建一个符号链接(symboliclink)到/opt/local/bin/rvm,但是当它运行时它什么也不做。我还尝试创建一个从~/.rvm/bin/rvm到/opt/local/bin/rvm的符号链接(symboliclink),当我运行rvm在终端中,它会按预期显示帮助页面。但是当我尝试rvmusesome_ruby_version时,它总是显示“RVM不是一个函数,选择带有‘rvmuse...

ruby-on-rails - 为什么 Rspec 说 "Failure/Error: Unable to find matching line from backtrace"?

我在这里学习Rails教程:http://railstutorial.org/chapters/filling-in-the-layout#top当我运行“rspecspec/”时,我得到一堆如下所示的错误:1)LayoutLinksshouldhaveaHomepageat'/'Failure/Error:Unabletofindmatchinglinefrombacktracestackleveltoodeep#C:/Ruby19/lib/ruby/1.9.1/forwardable.rb:1852)LayoutLinksshouldhaveaContactpageat'/cont

ruby-on-rails - Rails 是否带有 "not authorized"异常?

我正在编写一个应用程序,它使用普通的旧Ruby对象(PORO)从Controller中抽象出授权逻辑。目前,我有一个名为NotAuthorized的自定义异常类,我在Controller级别rescue_from,但我很想知道:DoesRails4alreadycome有一个异常(exception)表明某项操作未获授权?我是否通过实现此异常(exception)来重新发明轮子?澄清:引发AuthorizationException不会发生在Controller内部的任何地方,它发生在Controller外部完全分离的PORO内部。该对象不知道HTTP、路由或Controller。