草庐IT

javascript - jshint 错误 : Cannot find module \'underscore\'

全部标签

ruby-on-rails - pg_search 使用 associated_against 给出错误 "column [model_name].[associated_column_name] does not exist"

我正在尝试使用pg_search来搜索关联模型。当我运行搜索时,出现错误“PG::Error:ERROR:columnplans.namedoesnotexist”。我正在“计划”模型中运行搜索,并尝试针对“地点”与列“名称”的关联进行搜索。连接这些的has_many:through模型是多态的。不知何故,sql查询将两者结合起来并抛出错误。我已经运行了associated_against迁移(railsgpg_search:migration:associated_against),搜索了文档,并寻找其他有错误的人,但一无所获,一定是我只是忽略了一些东西。如果我只是删除plan.rb

ruby - ruby Date.today 和 DateTime.now 的日期错误

我已经使用RVM安装了ruby​​-1.8.6-p383。系统ruby是1.9.1_p378-1我在使用ruby​​1.8时从Date.today和DateTime.now得到错误的日期。而Time.now是正确的:irb(main):002:0>DateTime.now.to_s=>"2126--1-10618T11:23:43+00:00"irb(main):004:0>Date.today.to_s=>"2126--1-10618"irb(main):005:0>Time.now=>ThuJan2811:55:27+00002010如果我切换到ruby​​1.9,一切都很好:ir

ruby-on-rails - resque-web 启动失败,出现 500 服务器错误

我正在按照配置指南安装resque.我遇到了(OpenURI::HTTPError)。我正在使用RVM1.9.2-p180、rails3.0.6和POW.'resque-web'无法启动并出现500服务器错误。这到底是怎么回事?复制问题:用$redis-server启动redis使用$VVERBOSE=1QUEUE=file_serverakeenvironmentresque:work启动一个worker尝试启动Resque-Web:RAILS_ENV=developmentresque-webconfig/initializers/resque.rb配置/resque.ymldev

ruby - Ruby 守护进程中的错误文件描述符

在MacOSXLion上使用Rubyv1.8.7和Daemonsv1.1.8,我试图编写一个消费者进程并让它作为守护进程运行:#config[:name]=>'idx_my_delete_consumer'#config[:daemon]=>{:multiple=>false,#:backtrace=>true,#:dir_mode=>:normal,#:log_dir=>'/Users/pprakash/consumer.log',#:monitor=>true,#:dir=>'/Users/pprakash/pids'}Daemons.run_proc(config[:name],

ruby - 调试 Ruby 段错误

我如何确定段错误是由于不一致的库造成的,还是我正在使用的某些gem中的错误?$uname-aLinux[redacted]3.2.0-24-generic#39-UbuntuSMPMonMay2116:52:17UTC2012x86_64x86_64x86_64GNU/Linux$ruby1.9.1--versionruby1.9.3p0(2011-10-30revision33570)[x86_64-linux]$CPUPROFILE_OBJECTS=1CPUPROFILE=/tmp/my_app_profile_objectsRUBYOPT="-r`gem1.9.1whichper

ruby-on-rails - 在 Rails 应用程序中记录警告(不是错误),并管理它们

我正在寻找一个好的流程来处理Rails应用程序中的警告/信息类型的消息。例如,用户输入错误密码的次数,模型验证失败的次数等。特别是,我正在寻找一种有效的方法来操作这些指标,因为它们不是异常(exception),但可能表明潜在的错误或功能方面的问题。我正在考虑的解决方案是:记录WARNING或INFO消息并使用Splunk解析它们(不幸的是Splunk非常昂贵)在WARNING环境中发送Airbrake错误 最佳答案 你应该看看Papertrail作为Splunk+Airbrake的替代品。如果您只对日志记录感兴趣,这似乎更合适。

ruby - 延迟作业每次引发错误时都会创建空气制动器

defperformrefund_log={success:refund_retry.success?,amount:refund_amount,action:"refund"}ifrefund_retry.success?refund_log[:reference]=refund_retry.transaction.idrefund_log[:message]=refund_retry.transaction.statuselserefund_log[:message]=refund_retry.messagerefund_log[:params]={}refund_retry.er

ruby - rails omniauth 和 UTF-8 错误

我最近在使用omniauth尝试填充Google登录的某些字段时遇到错误Encoding::CompatibilityError:incompatiblecharacterencodings:ASCII-8BITandUTF-8"omniauth"=>{"user_info"=>{"name"=>"JoeMcÙisnean","last_name"=>"McÙisnean","first_name"=>"Joe","email"=>"someemail@gmail.com"},"uid"=>"https://www.google.com/accounts/o8/id?id=AItOaw

ruby-on-rails - bundle 使用了错误的 ruby​​ 版本

我在努力奔跑envRAILS_ENV=testbundleexecrakedb:migrate并得到如下错误您的Ruby版本是2.1.7,但您的Gemfile指定为2.2.3ruby-v给我ruby2.2.3p173(2015-08-18修订版51636)[x86_64-darwin15]如果重要的话,我正在使用rbenv。rbenvversions提供以下内容:系统*2.2.3(由/Users/thatsme/Projects/demoproject/.ruby-version设置)所以我没有安装ruby2.1.7。Spring没有运行,我运行了rbenvrehash。然后安装bun

ruby - 通过 API 和 ruby​​ 创建优惠券返回错误 : woocommerce_api_missing_coupon_data

我正在尝试使用本页文档中的示例代码通过我的Rails4应用程序的其余API创建优惠券:https://woocommerce.github.io/woocommerce-rest-api-docs/?ruby#create-a-coupon这是我使用的代码:data={code:"10off",discount_type:"percent",amount:"10",individual_use:true,exclude_sale_items:true,minimum_amount:"100.00"}woocommerce.post("coupons",data).parsed_resp