jjzjj

ruby-on-rails - 为什么 Rails 服务器会出现 "Could not find ' railties 错误?

当我使用railss启动Rails服务器时,出现以下错误:/usr/local/lib/site_ruby/1.8/rubygems/dependency.rb:296:in`to_specs':Couldnotfind'railties'(>=0)among10totalgem(s)(Gem::LoadError)from/usr/local/lib/site_ruby/1.8/rubygems/dependency.rb:307:in`to_spec'from/usr/local/lib/site_ruby/1.8/rubygems/core_ext/kernel_gem.rb:4

ruby-on-rails - Rails 中的推杆 : "Unknown auth_key" - server side not triggering events

我正在尝试将Pusher插入到我已经很晚的Rails应用程序中。客户端工作正常-使用PusherEventCreator触发所需的javascript。但是服务器端不工作:在我的通知Controller中使用以下代码创建要测试的操作:Pusher.trigger('private-4','new_message',{:from=>"christian",:subject=>"hello"})给出这个错误:Pusher::AuthenticationError(Unknownauth_key):app/controllers/notifications_controller.rb:57:

ruby-on-rails - rbenv : bundle: command not found on production server

我正在尝试部署Rails应用程序,但遇到错误DEBUG[1a70ba92]Command:cd/home/deploy/myapp/releases/20140615090226&&(PATH=$HOME/.rbenv/shims:$HOME/.rbenv/bin:$PATHRBENV_ROOT=~/.rbenvRBENV_VERSION=2.1.2~/.rbenv/bin/rbenvexecbundleinstall--binstubs/home/deploy/myapp/shared/bin--path/home/deploy/myapp/shared/bundle--withou

ruby-on-rails - Mongoid::Errors::DocumentNotFound raise_not_found_error

*在底部更新*当寻找不存在的用户时,我得到:Mongoid::Errors::DocumentNotFoundinUsersController#showProblem:Document(s)notfoundforclassUserwithid(s)22.Summary:WhencallingUser.findwithanidorarrayofids,eachparametermustmatchadocumentinthedatabaseorthiserrorwillberaised.Thesearchwasfortheid(s):22...(1total)andthefollowin

ruby - 应该 validate_format_of 。 not_with 在框架中有问题(或者在我的理解中)

我将以下代码放入RSpec测试中:it{shouldvalidate_format_of(:email).not_with('test@test')}并设置实际的类:validates:email,:presence=>true,:format=>/\b[A-Z0-9._%-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,4}\b/i当我运行测试时,我得到:失败:1)用户失败/错误:它{应该validate_format_of(:email).not_with('test@test')}当电子邮件设置为“test@test”时,预期错误包括“can'tbeblank”,得到错误

ruby-on-rails - Michael Hartl Rails Tutorial 第 7 章错误 Action not found in UsersController

我目前正在学习MichaelHartl的Rails教程,我已经顺利地达到了7.22。然而,我对测试的输出感到难过:Failures:1)UserPagessignupwithinvalidinformationshouldnotcreateauserFailure/Error:expect{click_buttonsubmit}.not_tochange(User,:count)AbstractController::ActionNotFound:Theaction'create'couldnotbefoundforUsersController#(eval):2:in`click_b

ruby-on-rails - 我得到 rvm : command not found after installation of rvm

我知道上面的问题是很常见的问题。我已经阅读了关于这个主题的多篇文章。但是我没有得到任何解决方案。我已经在本地安装了rvm。我们已经有了安装文件。所以进入文件夹并运行安装命令。$./install然后我检查了Users主文件夹中的./rvm文件夹$cd~/.rvm文件夹存在。至此安装成功。现在我在命令行输入rvm$rvm我正在低于异常$rvm-sh:rvm:commandnotfound在阅读了stackoverflow中有关此问题的多篇文章后,我了解到我必须在.bash_profile中添加以下行,因为我使用的是MacOSX10.7.3[[-s"$HOME/.rvm/scripts/r

ruby-on-rails - ruby rails : rails generate controller does not work

我是ruby​​和rails的新手,我在生成Controller时遇到了问题。一些上下文:$rails-vRails4.1.1应用已正确创建:$railsnewtest_appcreatecreateREADME.rdoccreateRakefilecreateconfig.rucreate.gitignorecreateGemfilecreateapp[...]Yourbundleiscomplete!Use`bundleshow[gemname]`toseewhereabundledgemisinstalled.runbundleexecspringbinstub--all*bin

ruby-on-rails - rails : Detecting user agent works in development but not production?

我正在尝试在我的应用程序中检测黑莓用户代理,这在我的开发版本中运行良好。但是当我在生产环境中重新部署该应用程序时,没有任何反应。application_helper.rbdefblackberry_user_agent?request.env["HTTP_USER_AGENT"]&&request.env["HTTP_USER_AGENT"][/(Blackberry)/]end应用程序.html.erbUsingaBlackberry?Usethemobileoptimizedversion.我已经尝试使用raketmp:cache:clear清除缓存并重新启动mongrel几次。显

ruby-on-rails - Rails 日志文件 "not opened for writing"

我正在将我的应用程序从ruby​​1.8.7迁移到1.9.3(然后升级Rails)。但是我在登录1.9.3时遇到了一些问题。通过在控制台或服务器启动时在environment.rb中使用以下代码logfile=File.open(File.join(RAILS_ROOT,'/log/call_log.log'),'a')CALL_LOGGER=AuditLogger.new(logfile)CALL_LOGGER.info"CALL_LOGGER:Serverstarted."我明白了/usr/local/rvm/scripts/irbrc.rb:32:in`write':notope