草庐IT

load_valid

全部标签

ruby-on-rails - 创建新的 Rails 3 项目时出错 : `require' : cannot load such file -- openssl (LoadError)

当我尝试创建一个新项目($railsnewfirst_app)时,它在创建目录结构后出现以下错误。......createvendor/plugins/.gitkeeprunbundleinstall/home/amit/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in`require':cannotloadsuchfile--openssl(LoadError)from/home/amit/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site

ruby-on-rails - Heroku 和 Rails : Gem Load Error with Postgres, 但它在 GEMFILE 中指定

所以我正在尝试将一个小项目部署到Heroku,但是当我部署它并尝试运行herokurunrakedb:migrate时,它返回了以下错误:rakeaborted!Gem::LoadError:Specified'postgresql'fordatabaseadapter,butthegemisnotloaded.Add`gem'pg'`toyourGemfile(andensureitsversionisattheminimumrequiredbyActiveRecord)./app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.6/li

ruby - Heroku 应用程序无法启动 - `require' : no such file to load -- sinatratestapp (LoadError)

我正在尝试使用bamboo-mri-1.9.2堆栈运行我的Heroku应用程序。当然,它在Ruby1.9.2上本地运行良好。但是在生产环境中,它在执行config.ru的启动过程中崩溃,如下所示:require'sinatratestapp'runSinatra::Application我的.gems文件:sinatra--version'>=1.0'应用程序本身为sinatratestapp.rb:require'rubygems'require'sinatra'get'/'do"HellofromSinatraonHeroku!"end这就是我在项目中得到的所有内容,并尝试在Her

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-on-rails - rails : Validation in model vs migration

这个问题在这里已经有了答案:关闭10年前。PossibleDuplicate:RubyonRails:Isitbettertovalidateinthemodelorthedatabase?我看到可以在Rails模型和迁移中添加相同的约束/验证。但是哪一个是最好的方法呢?在模型和数据库级别进行验证是否是一种好的做法(以及为什么)?或者他们在rails上一样?例如我们可以在模型和迁移中对名称进行相同的验证classUsertrue,:presence=>trueendclassCreateUsertrue,:null=>falseendendend

ruby-on-rails - rails 3 : validate presence of at least one has many through association item

我有两个模型:Project和ProjectDiscipline:classProject:destroyhas_many:project_disciplines,through::project_disciplinizationsattr_accessible:project_discipline_idsattr_accessible:project_disciplines_attributesaccepts_nested_attributes_for:project_disciplines,:reject_if=>proc{|attributes|attributes['name'

ruby-on-rails - ruby 包安装需要 : no such files to load error

我在通过git克隆的应用程序的bundleinstall安装gems时遇到了麻烦。这是bundleinstall的输出:bundleinstall/usr/lib/ruby/vendor_ruby/bundler/rubygems_ext.rb:8:in`require':nosuchfiletoload--rubygems(LoadError)from/usr/lib/ruby/vendor_ruby/bundler/rubygems_ext.rb:8from/usr/lib/ruby/vendor_ruby/bundler.rb:11:in`require'from/usr/lib

ruby-on-rails - rails : validating a field is present only if another is present

我有一个模型,其中有两个字段在技术上可以为空。字段名称是:is_activated和:activated_at。:activated_at仅在:is_activated设置为true时才需要。如果:is_activated为false,则不需要存在。在Rails中将此验证直接设置到ActiveRecord中的合适方法是什么? 最佳答案 您可以使用Proc在:activated_at验证器上。validates:activated_at,:presence,if:Proc.new{|a|a.is_activated?}推荐阅读:htt

ruby - 加载错误 : cannot load such file -- rspec/core/rake_task

当我rake的时候,我得到了这个错误。AllenLins-MacBook-Pro:geoblacklightallenlin$rake-tResolvingdependencies...Youmust`geminstallbundler`and`bundleinstall`torunraketasksrakeaborted!LoadError:cannotloadsuchfile--rspec/core/rake_task/Users/allenlin/Documents/USpatial/geoblacklight/Rakefile:12:in`require'/Users/alle

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