ruby-debug由于某些原因无法创建Makefile,可能缺少必要的库和/或头文件

我的Rails是3.2.1.4 ,Ruby是1.9.3p448 。 我安装ruby-debug时遇到错误: Building native extensions. This could take a while… ERROR: Error installing ruby-debug: ERROR: Failed to build gem native extension. /home/hxh/.rvm/rubies/ruby-1.9.3-p448/bin/ruby extconf.rb Can’t handle 1.9.x yet *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. […]

什么::(双冒号)在Ruby中意味着什么?

什么在Ruby中意味着什么? 例如Foo::Bar 。

Ruby 1.9 Array.to_s的行为有何不同?

我写了一个快速的小应用程序,它采用一些代码的基本文件和一些关键字,一个替换关键字的文件,并输出一个替换关键字的新文件。 当我使用Ruby 1.8时,我的输出看起来很好。 现在使用Ruby 1.9时,我替换的代码中包含换行符而不是换行符。 例如,我看到类似的东西: [“\r\nDim RunningNormal_1 As Boolean”, “\r\nDim RunningNormal_2 As Boolean”, “\r\nDim RunningNormal_3 As Boolean”] 代替: Dim RunningNormal_1 As Boolean Dim RunningNormal_2 As Boolean Dim RunningNormal_3 As Boolean 我使用替换哈希{“KEYWORD”=> [“1”,“2”,“3”]}和替换行的数组。 我用这个块完成更换: resultingLibs.each do |x| libraryString.sub!(/((.*?))/im) do |match| x.each do |individual| individual.to_s end end end #for each resulting group of the repeatable pattern, […]

Rails Resque工作程序因PGError而失败:服务器意外关闭了连接

我在Ubuntu 9.10,Rails 2.3.4,ruby-ee 2010.01,PostgreSQL 8.4.2上有站点运行rails应用程序和resque worker在生产模式下运行 工人不断提出错误:PGError:服务器意外关闭了连接。 我最好的猜测是主resque进程建立与db的连接(例如authlogic在使用User.acts_as_authentic时执行此操作),同时加载rails app类,并且该连接在fork()ed进程中损坏(退出?),所以下一个分叉孩子们得到了一些破碎的全局ActiveRecord :: Base.connection 我可以使用此示例代码重现非常类似的行为,模仿resque worker中的fork / processing。 (AFAIK,libpq的用户建议无论如何都要在forked进程中重新创建连接,否则它不安全) 但是,奇怪的是当我使用pgbouncer或pgpool-II而不是直接的pgsql连接时,不会出现这样的错误。 那么,问题是我应该在哪里以及如何挖掘以找出为什么它被破坏以进行普通连接并且正在使用连接池? 还是合理的解决方法?

试图为ror app设置postgres,收到错误 – fe_sendauth:没有提供密码

获得: An error has occurred: Error connecting to the server: fe_sendauth: no password supplied database.yml中的设置与其他计算机上的应用程序设置相同。 如何设置以便我不需要硬编码的密码? 我可以使用PgAdmin-III查看db ok。 我宁愿没有database.yml的密码,因为使用这个应用程序的其他机器没有/需要它,所以它似乎可能与我的Pg安装有关。

使用Xcode 4.3.1在Mac上更新Ruby

我正在使用RVM来安装它,它给了我这个错误: The provided compiler ‘/usr/bin/gcc’ is LLVM based, it is not yet fully supported by ruby and gems, please read `rvm requirements`. 我在Lion 10.7.3上,我有Xcode 4.3.1。

Paperclip在保存后重命名文件

如何在上传和保存文件后重命名文件? 我的问题是我需要自动解析有关文件的信息,以便提出文件应该像我的应用程序一样保存文件名,但我无法访问生成文件名所需的信息,直到记录为止。模型已保存。

如何将字符串转换为方法调用?

如何使用字符串作为方法调用? “Some Word”.class #=> String a = “class” “Some World”.a #=> undefined method ‘a’ “Some World”.”#{a}” #=> syntax error, unexpected tSTRING_BEG

当我运行`bundle exec rake test:prepare`它出错了,但是`bundle exec rake db:test:prepare`会很好地发出警告。 这是怎么回事?

所以根据这个链接,一个是快捷包装器(所以我猜它们是相同的)。 当我运行bundle exec rake db:test:prepare ,我收到此错误: Don’t know how to build task ‘test:prepare’ /Users/aj/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/bin/ruby_executable_hooks:15:in `eval’ /Users/aj/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/bin/ruby_executable_hooks:15:in `’ …但是当我运行bundle exec rake db:test:prepare ,我收到此警告: WARNING: db:test:prepare is deprecated. The Rails test helper now maintains your test schema automatically, see the release notes for details. 任何人都可以阐明这一点吗?

找不到捆绑命令。 坏翻译

我对bundler gem有一些问题。 当我运行“gem list”时,我可以看到已经安装了bundler。 “bundler(1.1.3,1.0.21)”。 但是,当我尝试运行命令“bundle”时,我收到以下消息: sh.exe”: /c/Program Files (x86)/ruby-1.9.3/bin/bundle: “c:/Program: bad interpreter: No such file or directory 我认为这是一些路径错误,但无论我谷歌多少,我都无法找到解决问题的方法。 有人有任何提示吗? 这是我的路径: C:\Program Files (x86)\AMD APP\bin\x86_64; C:\Program Files (x86)\AMD APP\bin\x86; C:\Program Files\Common Files\Microsoft Shared\Windows Live; C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live; C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common; %SystemRoot%\system32; %SystemRoot%; %SystemRoot%\System32\Wbem; %SYSTEMROOT%\System32\WindowsPowerShell\v1.0\; C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static; C:\Windows\system32\gs\gs8.71\bin; C:\Program Files […]