草庐IT

application-client

全部标签

ruby - Capybara-webkit、rspec 集成规范和 xvfb : webkit_server: Fatal IO error: client killed

我正在尝试使用headless(headless)gem、xvfb和用于headless(headless)测试的capybara-webkit来获得在ubuntu服务器CI盒上运行的一套集成规范。一切都在本地开发箱上运行良好,但一旦转移到CI服务器,事情就会变得有趣。在规范助手中有一些代码包装:js在headless(headless)block中启用集成规范,如下所示:config.around(:each,:js=>true)do|example|Headless.ly&exampleend就像我说的,这一切都在本地开发箱上运行良好。在CI上,它使用headless(headle

javascript - 从 Rails 3 中的 application.js 访问 current_user 变量

我希望从我的application.js访问我的current_user变量(我将我的application.js重命名为application.js.erb以便服务器可以理解我的ruby​​代码),所以我得到了类似的东西:functionhello(){alert("");}但失败了:我如何从位于/assets/my_script.js.erb中的脚本中获取像current_user这样的session变量,我认为它不应该被启用,因为这些变量可能无法从公共(public)站点访问,或者什么应该怎么做?谢谢! 最佳答案 Applic

ruby-on-rails - 运行 'rake assets:precompile' 产生错误 : '` @application. css' is not allowed as an instance variable name'

我正在开发一个Rails3.2应用程序,我正在尝试测试预编译我的Assets,以便在我将我的应用程序投入生产时使用。该应用程序在开发中运行良好,但当我运行时:bundleexecrakeassets:precompile我收到以下错误:rakeaborted!`@application.css'isnotallowedasaninstancevariablename我搜索了我的代码,没有对application.css的引用,当然除了那个名称的文件(以及偶尔的评论)。我也试过在生产模式下设置config.assets.compile=true,但也失败了(应用服务器启动正常,但在pro

ruby-on-rails - App::Application.load_tasks 在哪里定义?

关闭。这个问题不符合StackOverflowguidelines.它目前不接受答案。我们不允许提问寻求书籍、工具、软件库等的推荐。您可以编辑问题,以便用事实和引用来回答。关闭7年前。Improvethisquestion#Addyourowntasksinfilesplacedinlib/tasksendingin.rake,#forexamplelib/tasks/capistrano.rake,andtheywillautomaticallybeavailabletoRake.requireFile.expand_path('../config/application',__FI

ruby-on-rails - 如何使用 rest-client gem 发送 header 和 cookie

在代码中,我试图在同一个请求中发送header和cookie下面是代码@result=RestClient.post('url',{:billingSourceCode=>"code"},{:cookies=>{:session_id=>"1234"}},{:headers=>{'Content-Type'=>'application/json',"Authorization"=>"key","Accept"=>"application/json"}})我收到以下错误信息ArgumentError(wrongnumberofarguments(4for3)):

ruby-on-rails - 找不到符号 : _SSLv2_client_method (LoadError)

当我尝试运行服务器时出现以下错误/Users/brijesh/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/openssl.rb:17:in`require':dlopen(/Users/brijesh/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/x86_64-darwin12.5.0/openssl.bundle,9):Symbolnotfound:_SSLv2_client_method(LoadError)Referencedfrom:/Users/brijesh/.rvm/rubies/ruby-

ruby-on-rails - Heroku 上的应用程序错误 : An error occurred in the application and your page could not be served

有一个正在开发但已部署问题的工作Rails应用程序。最近在工作,但在添加clouldmailin后似乎会导致一些依赖性问题?非常感谢任何有助于理解日志中问题的帮助。2012-01-11T23:35:07+00:00app[web.1]:from/app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/application.rb:96:in`initialize!'2012-01-11T23:35:07+00:00app[web.1]:from/app/vendor/bundle/ruby/1.9.1/gems/railti

ruby-on-rails - rails client_side_validations 和选择标签

gemclient_side_validations不验证未选择项目的选择标签。可能需要在模型或.erb文件中传递一些参数? 最佳答案 解决方案正在尝试验证存在。尝试验证数值/大于>0。 关于ruby-on-rails-railsclient_side_validations和选择标签,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/15845078/

ruby - 使用 google-api-ruby-client '0.9.pre3' 发送 gmail 邮件

在Rails4应用程序中使用较新的google-api-ruby-client发送gmail。require'google/apis/gmail_v1'Gmail=Google::Apis::GmailV1classMailServicedefinitialize(params)@params=paramsenddefcallmessage=Gmail::Message.newservice=Gmail::GmailService.newmessage.raw=(redacted)service.request_options.authorization=current_user.to

ruby - 事件机器 : How to build a chat system with Rails application

我正在使用EventMachine和ruby​​onrails构建一个聊天系统。这是为了学习目的。这就是客户端连接到服务器的方式。c=TCPSocket.open(ip_address,port)data={:user_id=>2,:message=>'helloworld'}c.send(data)response=c.getsc.close它有效。但是问题是我无法获得当前在房间里聊天的人的列表,因为如上所示,客户端不断打开和关闭连接。另一种计划是为每个连接的用户运行一个EventMachine客户端。我计划为每个用户在session中存储客户端连接。通过这种方式,我将为每个用户使用