草庐IT

no-restricted-syntax

全部标签

ruby-on-rails - rspec - 我怎样才能让 "pendings"有我的文本而不仅仅是 "No reason given"

我有这个代码:context"Visitingtheusers#indexpage."dobefore(:each){visitusers_path}subject{page}pending('iii'){shouldhave_no_css('table#users')}pending{shouldhavecontent('Youhavereachedthispageduetoapermissionic错误')}它会导致几个待处理,例如ManagingUsersGivenapractitionerloggedin.Visitingtheusers#indexpage.#Noreason

ruby-on-rails - Rails - Carrierwave 进程抛出 ArgumentError : no images in this image list

在尝试实现应用auto_orient的过程之后!对于我的图片,我收到此错误:ArgumentError(noimagesinthisimagelist):app/uploaders/image_uploader.rb:36:in`fix_exif_rotation'app/controllers/posts_controller.rb:12:in`create'Carrierwave在没有进程的情况下工作正常,但在添加进程后尝试上传图像时抛出错误。流程如下:process:fix_exif_rotationdeffix_exif_rotationmanipulate!do|image|

ruby-on-rails - Rails参数,为什么params[ :key] syntax?

我正在尝试手动创建一些参数以传递给RailsController函数,为什么参数散列的键用冒号列出,例如params[:key]而不是params["key"]? 最佳答案 Rails使用ActiveSupport’sHashWithIndifferentAccess对于几乎所有来自其自身的哈希值,例如params。HashWithIndifferentAccess的行为与常规哈希相同,除了通过符号或具有相同“值”的字符串进行键访问会返回相同的哈希值。例如:h=HashWithIndifferentAccess.newh[:foo]

ruby-on-rails - 在 Rails 中,我从 Guard 那里收到这个错误,说我必须更新到新的 :cmd syntax

我刚刚更新了我的gem,当我尝试运行Guard时,出现以下错误:Guard::RSpecDEPRECATIONWARNING:The:clioptionisdeprecated.Pleasecustomizethenew:cmdoptiontofityourneed.这是我的Guard文件:guard'rspec',cli:'--drb'dowatch(%r{^spec/.+_spec\.rb$})watch(%r{^lib/(.+)\.rb$}){|m|"spec/lib/#{m[1]}_spec.rb"}watch('spec/spec_helper.rb'){"spec"}#Ra

Ruby gem 安装和 "No such file to load"

我在Backtrack5中使用Ruby1.9.2dev编写脚本,但在尝试使用库“htmlentities”解析html实体时遇到了一些问题。虽然我已经用gem安装了它,但我无法加载它。我将向您展示我在控制台中遇到的问题:root@bt:~#gemlist-dhtmlentities***LOCALGEMS***htmlentities(4.3.1)Author:PaulBattleyHomepage:https://github.com/threedaymonk/htmlentitiesInstalledat:/var/lib/gems/1.9.2Amoduleforencodinga

ruby - 杰基尔服务错误 : no implicit conversion of nil into String

我用这个错误搜索了jekyll。jekyll处理页面时似乎出现了ruby​​错误,但我根本不了解ruby​​。杰基尔版本1.3.1我什至重新安装了ruby​​和jekyll,但结果没有改变。更新:在我将jekyll从1.31降级到1.20后,这个错误消失了注意:我的网站是用jekyll1.20创建的,所以它不能用1.3.1构建?这是核心问题吗?E:\GitHub\sample>jekyll服务--trace:Configurationfile:E:/GitHub/sample/_config.ymlSource:E:/GitHub/sampleDestination:E:/GitHub

ruby - 无法启动 sinatra 进程 - eventmachine "no acceptor"

我有一个作为守护程序运行的Sinatra应用程序,使用Apache端口转发在端口80和端口7655之间进行调解。这在过去一直运行良好。今天,不太好。我不明白为什么。问题:sudoruby​​my_process.rb返回:/var/lib/gems/1.9.1/gems/eventmachine-1.0.0/lib/eventmachine.rb:526:in`start_tcp_server':noacceptor(portisinuseorrequiresrootprivileges)(RuntimeError)尝试过:更新所有系统包,更新所有gem。没有帮助(除了来自eventm

ruby - Rails+ActiveAdmin - 使用 ransacker 过滤会抛出错误 PG::SyntaxError: ERROR: syntax error at or near ","

我在RubyonRails4.1.4上有一个项目,使用来自git://github.com/activeadmin/activeadmin的activeadmin1.0.0.pre,pg0.17.1,PostgreSQL9.3在项目中我有这些模型:类用户has_one:账户类账户属于:用户有很多:project_accountshas_many:项目,:through=>:project_accounts类项目#该项目有一个bool属性'archive'has_many:project_accounts类ProjectAccount属于:帐户属于:项目我有一个任务是在索引页面上实现一个

ruby - 为什么 Thor 具有 no_tasks 方法?

或者,更具体地说:我不能只使用私有(private)方法吗? 最佳答案 据我了解,Thor具有将方法标记为notasks的方法因为方法是任务的概念不同于方法的visibility的概念。.他们需要区分,因为他们从事不同的工作。类Thor的子类的每个方法(独立于其可见性)都被视为任务,除非它被明确标记为无任务。通过控制任务的可见性,您可以控制对该任务的访问,例如如果您将任务设为私有(private),则它不能被子类调用或直接被用户调用。访问控制不同于某事是否是任务。非任务的方法不能被Thor直接调用,它们不能有options.这里举个

ruby 在 `gem_original_require' : no such file to load -- CloudyScripts (LoadError)

在Ubuntu和Ruby1.8.7上,我通过以下方式安装了CloudyScripts:geminstallgeminstallCloudyScripts当我尝试执行此操作时:require'rubygems'require'CloudyScripts'我收到以下错误:/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in`gem_original_require':nosuchfiletoload--CloudyScripts(LoadError)from/usr/lib/ruby/1.8/rubygems/custom_require.r