草庐IT

missing-cookies

全部标签

ruby-on-rails - 覆盖类和实例方法的 method_missing?

我正在尝试编写一个通用模块,以将用于动态方法创建的method_missing模式应用于我的某些Rails模型。这些模型既有类方法也有实例方法。虽然我可以相当直接地为任一类案例编写模块:moduleClassVersionextendActiveSupport::ConcernmoduleClassMethodsdefmethod_missing(meth,*args,&block)ifmeth.to_s=~/^(.+)_async$/Async::handle_asyncself,$1,*args,&blockelsesupermeth,*args,&blockendend#Logi

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-on-rails - RSpec Controller 测试 : missing template on create

我有一个有趣的情况。我正在测试以下简单的创建操作:#willonlybeaccessedviaAjaxdefcreateclick=Click.new(params[:click])click.save#don'treallycarewhetheritssuccessorfailureend然后我有以下非常简单的Controller规范:require'spec_helper'describeClicksController,"creatingaclick"doit"shouldcreateaclickforevent"doxhr:post,:create,:click=>{:even

ruby-on-rails - rails 错误 method_missing':Gem::Specification 的未定义方法 `this'

我遵循这个教程:https://guides.spreecommerce.com/developer/getting_started_tutorial.html#installing-image-magick当我写作时jonstark@jonstark-pc:~/rails_projects/optima1$spreeinstall--auto-accept我明白了:/home/jonstark/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/specification.rb:2158:in`method_missing':undefine

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

ruby-on-rails - 我得到 "Missing these required gems",但安装了 gem

自从我使用MacPorts(在Leopard上)更新了ruby​​后,我遇到了几个问题,我还不得不重新安装gems。现在,当我运行Mongrel时,我不断收到错误“缺少这些必需的gems”,然后是我在environment.rb中需要的gems列表,但是当我看到运行gemlist时,这些gems似乎已正确安装.我认为rails正在寻找以前的安装,但我不知道如何配置它以使用新的ruby​​/gem路径。谢谢! 最佳答案 你应该使用:config.gem'rspec',:lib=>'spec'config.gem'rspec-rails

ruby-on-rails - 由于 cookie 的 8 位编码(Rails 3 和 Ruby 1.9)导致错误 'incompatible character encodings: ASCII-8BIT and UTF-8'

我将一个使用1.8.7的网络应用程序移到了1.9.2,现在我一直在使用incompatiblecharacterencodings:ASCII-8BITandUTF-8我有UTF-8的数据库编码,我还有'config.encoding="utf-8"'。我看到了一些想法作为可能的解决方法并添加了Encoding.default_external=Encoding::UTF_8Encoding.default_internal=Encoding::UTF_8但是也没用。出现此错误的一段特定代码是%ul.address-@user.address.split(',').eachdo|lin

ruby-on-rails - RSpec load_missing_constant,期望 X 定义 Y(确实如此)

当我们运行时bundleexecrake规范尝试加载环境时出现错误:...gems/activesupport-3.2.8/lib/active_support/dependencies.rb:503:in`load_missing_constant':Expected...app/models/links/category.rbtodefineLinks::Category(LoadError)文件app/models/links/Category.rb确实定义了Links::Category。更奇怪的是,在guard和spork下运行时不会发生错误(我们运行测试的标准方式):bun

ruby-on-rails - 使用 Rspec v.1 测试响应 cookie

当我登录到我的应用程序时,服务器会发回cookie(凭据和某些应用程序的cookie):Responsesent170bytesofCookiedata:Set-Cookie:user_credentials=val;path=/;HttpOnly;SecureResponsesent554bytesofCookiedata:Set-Cookie:_app_session=otherVal;path=/;HttpOnly;Secure...然后重定向到主页;Cookie包含一些标志:例如httpOnly、Secure等我如何测试cookie是否包含那些带有Rspec的标志?至少我在哪里

ruby-on-rails - 在 Rails 中的何处设置跟踪(永久)cookie?

我正在尝试跟踪“匿名”用户的操作,并在他们注册后最终将其与他们的帐户相关联。我想我会通过设置永久cookie来做到这一点。我最好的选择是在ApplicationController中包含以下内容:classApplicationController这是正确的方法还是有更好的解决方案? 最佳答案 看起来不错,永久性cookie在未来(20年左右)过期,所以只要用户不手动删除它,您就应该能够跟踪他。我在很多地方都使用了这样的结构,而且效果很好。如果您包含要通过此操作加载的内容(典型的跟踪像素),您甚至可以让它在外部着陆页上运行。