草庐IT

is-at-bottom

全部标签

ruby - Cucumber 测试无法启动,错误为 "Display socket is taken but lock file is missing.."

运行cucumber后bundleexeccucumberfeatures/emails.feature:20我遇到了错误Displaysocketistakenbutlockfileismissing-checktheHeadlesstroubleshootingguide(Headless::Exception)/Users/me/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/headless-2.2.0/lib/headless.rb:195:inensure_xvfb_is_running'/Users/me/.rbenv/ver

ruby - 我如何在不使用 ruby​​ 中的 sleep() 的情况下 rspec/test 一个 updated_at 字段?

如何在不使用sleep(1.second)方法的情况下编写规范?当我取消sleep时,我的测试会因为返回相同的时间戳而中断吗?我有以下类方法:defskipqs=find_or_create_by(user_id:user_id)qs.set_updated_atqs.n_skip+=1qs.save!end和以下规范:qs=skip(user.id)sleep(1.second)qs2=skip(user.id)qs.should_notbe_nilqs2.should_notbe_nil(qs.updated_at 最佳答案 我

ruby-on-rails - 如何删除 "DEPRECATION: stub! is deprecated. Use stub instead."消息?

问题的表述有点奇怪,但我想要的是Rspec中stub!的替代方案,它不会产生弃用警告。场景:我使用stub!在我的帮助程序规范中对某些帮助程序方法进行stub。例如stub!(:t_with_partner_lookup).and_return("test")Rspec建议使用不带感叹号的stub。所以我写(按照建议):stub(:t_with_partner_lookup).and_return("test")但是这会产生错误:Stub:t_with_partner_lookupreceivedunexpectedmessage:and_returnwith("test")在我发现的

ruby-on-rails - rails : Omniauth - "The parameter app_id is required"

我正在按照这个railscast教程在我的rails项目上为facebook身份验证设置omniauth:http://railscasts.com/episodes/360-facebook-authentication?autoplay=true.我只用了4分钟,到目前为止我所做的就是捆绑gemomniauth-facebook并添加,omniauth.rbOmniAuth.config.logger=Rails.loggerRails.application.config.middleware.useOmniAuth::Builderdoprovider:facebook,ENV

ruby - main :Object (NoMethodError) though method is defined 的未定义方法

我已经使用以下代码片段定义了一个脚本:check_paramsparamdefcheck_params(param)#somecodeend当我运行它时,我得到了undefinedmethod`check_params'formain:Object(NoMethodError) 最佳答案 Ruby期望方法在你调用它之前被声明,尝试在你调用方法之前移动你的方法定义:defcheck_params(param)#somecodeendcheck_paramsparam 关于ruby-main

ruby - Aptana 3 ruby​​ 调试器 - DebugThread 循环中的异常 : undefined method `is_binary_data?'

我正在尝试在Aptana3中调试简单的ruby​​文件。classHelloWorlddefinitialize()enddefgreet()puts"helloworld"endendh=HelloWorld.newh.greet断点设置为h.greet在我开始调试后,调试器启动,但是当它尝试初始化ruby​​类时,调试器断开连接并显示消息FastDebugger(ruby-debug-ide0.4.9)listenson:54749ExceptioninDebugThreadloop:undefinedmethod`is_binary_data?'for"#":String当我将断

ruby-on-rails - Rails 国际化 : %{record} is not being translated

我的rails.pt-BR.yml上有这个:br:errors:format:!'%{attribute}%{message}'messages:restrict_dependent_destroy:one:"Nãoépossívelexcluiroregistropoisexisteum%{record}dependente"many:"Nãoépossívelexcluiroregistropoisexistem%{record}dependentes"在我的模型中,我有这个:has_many:entities,dependent::restrict_with_error每当res

ruby-on-rails - Rails - 如何更改 created_at 时间?

在我的Controller中我有:@konkurrencer=Rating.new(params[:kon])@konkurrencer.save@konkurrencer.konkurrencer.rating_score+=params[:kon][:ratings].to_i@konkurrencer.konkurrencer.ratings+=1@konkurrencer.created_at=Time.now.strftime("%Y-%m-%d00:00:00")@konkurrencer.save当我创建一个新项目时,它的created_at列是:2012-02-2716

ruby-on-rails - Rails 3.2 ActiveAdmin 'Collection is not a paginated scope.' 错误

我正在使用Rails3.2和ActiveAdmin0.4.4开发应用程序。我有一个名为Teaser的模型(/app/models/teaser.rb):classTeasertruemount_uploader:img,TeaserUploaderend然后我向其中添加了ActiveAdmin(/app/admin/teaser.rb):#encoding:UTF-8ActiveAdmin.registerTeaserdoformdo|f|f.inputs"Teaser"dof.input:name,:label=>'Текст'f.input:url,:label=>'Ссылка'

ruby-on-rails - rails : is Passenger Standalone suitable for production deployment?

问题标题几乎概括了它...我一直无法找到任何好的资源来概述使用PhusionPassengerStandalone进行Rails应用程序部署的优缺点。它与运行PassengerNginx或PassengerApache相比如何?.htaccess之类的东西是否继续按预期工作?任何见解将不胜感激!谢谢! 最佳答案 Standalone建立在Nginx之上。你可以直接将它连接到端口80,它的行为很像PhusionPassenger+Nginx:它可以非常快速地提供静态文件,它会根据流量自动启动和停止进程,它会在它们运行时自动重启进程崩溃