草庐IT

ruby-on-rails - 尝试加载 gem 时出错 'devise. ActiveSupport: Duration can' t 被强制转换为整数

我已经尝试修复这个错误一段时间了,但没有找到任何帮助,请帮忙。我正在尝试使用devisegem在我的ROR应用程序上运行迁移。但是我从ActiveSupport收到错误消息“无法将持续时间强制转换为整数”。这发生了,然后我尝试运行:rakedb:migrate我不确定它是否与迁移代码有关,或者是否与新设计版本有关。这是错误消息:/home/sam/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.1.1/lib/active_support/values/time_zone.rb:285:warning:cir

ruby-on-rails - 在 RSpec 中使用 Ruby 1.9.2 需要 lib 带来 "no such file to load"

我正在尝试将我的一个Rails项目升级到Ruby1.9.2。一切进展顺利,但一个RSpec测试失败了。在这个测试中,我需要一个Rubylib:#filespec/models/my_lib_spec.rbrequire'spec_helper'require'lib/services/my_lib'describe"MyLib"doit"shoulddosomething"do...库看起来像这样:#filelib/services/my_lib.rbclassMyLibdefself.do_something...在Ruby1.8.7(REE)中测试运行良好:$ruby-vruby1

Ruby gem mysql2 安装错误

我在Windows7中安装了Ruby版本ruby​​1.9.2p0(2010-08-18)[i386-mingw32]。和gem版本1.3.7当我尝试安装mysqlgem时,它显示Failedtobuildgemnativeextension错误,这是为什么?我的mysql版本是5.1.36(WampServer)E:\RubyApps\test_app2>geminstallmysql2Buildingnativeextensions.Thiscouldtakeawhile...ERROR:Errorinstallingmysql2:ERROR:Failedtobuildgemnat

ruby - 如何使用 lib minitest 或 Test :Unit? 为单元测试着色

我想在我的开发环境中进行单元测试输出颜色。但是,我无法让它在Linux(Debian和Ubuntu)上运行。当我包含以下库时:require'minitest/autorun'require'minitest/unit'require'minitest/pride'我得到:/usr/local/rvm/gems/ruby-1.9.2-p136/gems/minitest-2.3.1/lib/minitest/pride.rb:35:in`':undefinedmethod`output'forMiniTest::Unit:Class(NoMethodError)由代码引起:MiniTe

ruby-on-rails - 无法加载此类文件 -- 1.9/bcrypt_ext (LoadError)

嘿,当我尝试启动Rails服务器时出现以下错误有什么想法吗?目前没有可行的解决方案...顺便说一下,我运行的是Windows8...可能根本就是问题所在:DC:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in`require':cannotloadsuchfile--1.9/bcrypt_ext(LoadError)fromC:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.

ruby-on-rails - 找不到路径 "/sessions/user"的设计映射设计登录错误

最近几天很郁闷。我有一个安装了Devise的Rails应用程序,我在其中生成了一个新的用户模型,并且还生成了DeviseView。当我在填写电子邮件和密码字段后单击“登录”并尝试以现有用户身份登录时,会发生这种情况:AbstractController::ActionNotFound-Couldnotfinddevisemappingforpath"/sessions/user".Thismayhappenfortworeasons:1)Youforgottowrapyourrouteinsidethescopeblock.Forexample:devise_scope:userdog

ruby-on-rails - 错误 "' Validate_default_type !': An option' s default must match its type (ArgumentError)"when running Ruby on Rails generate on Windows

我正在关注thistutorial并且刚刚开始。我已经使用geminstallrails安装了RubyonRails,并使用railsnewblog创建了一个博客。教程现在说我需要运行railsgeneratecontrollerWelcomeindex,但是当我这样做时,我得到了这个错误:C:/Ruby22/lib/ruby/gems/2.2.0/gems/thor-0.19.2/lib/thor/parser/option.rb:130:in`validate_default_type!':Anoption'sdefaultmustmatchitstype.(ArgumentErr

ruby - 使用 Rails3 和 Ruby 1.9.2 运行 Mongrel 时出现 LoadError

我是编程新手(以前只学过html/css/design),想通过SimplyRails2这本书开始学习RoR。不过,我想从最新版本的Ruby(1.9.2)和Rails(3)所以我被迫在没有这本书的情况下配置所有内容。我通过谷歌和stackoverflow看了很多。当我运行railsserver时,它会自动使用Webrick,但我想使用Mongrel。我通过geminstallmongrel--pre安装了预发布的Mongrel并删除了以前的版本。我读到为了让Mongrel与railsserver一起工作,我不得不将gem'mongrel'添加到Gemfile,但我不知道我应该添加哪一个

ruby-on-rails - ActiveAdmin 评论模型无法正常工作

我通过关注GettingStartedwithRails创建了一个博客恰恰。然后我按照这里的教程尝试ActiveAdmin:http://activeadmin.info/documentation.html.它适用于Post和Tag模型(我登录并创建/添加/编辑内容)但不适用于Comment模型。railsgenerateactive_admin:resourceCommentcreateapp/admin/comments.rb然后当我尝试启动服务器时,我得到了这个:railsserver=>BootingWEBrick=>Rails3.0.7applicationstarting

ruby - Jekyll - 运行错误 'Jekyll Serve'

编辑:找到答案(见下面我的答案!)。它涉及使用版本1.4.2而不是1.4.3,因此如果有人对让1.4.3工作有任何想法,那也可能会有所帮助。谢谢!编辑2:感谢下面的评论,看来1.4.3在Windows上运行时确实有问题。https://github.com/jekyll/jekyll/issues/1948我刚刚在我的Windows7计算机上安装了jekyll。我安装了ruby​​和开发包。我已经运行了geminstalljekyll并成功完成。我根据jekyll文档创建了一个新站点。我遇到的问题发生在我尝试运行jekyllserve时。请在下面找到错误输出。PSC:\jekyll\t