草庐IT

google-chrome-console

全部标签

ruby - Sinatra 不会在 Chrome 上通过重定向保持 session

Sinatra没有在Chrome上通过重定向保留我的session。它正在创建一个全新的session,我正在丢失我以前的所有session数据。举个例子(类似于theSinatradocs),我正在做这样的事情:enable:sessionsget'/foo'dosession[:user_id]=123session[:session_id]#"ABC",forexampleredirectto('/bar')endget'/bar'do#thisis"DEF"whenrespondingtoChrome(wrong),#but"ABC"whenrespondingtoFirefo

ruby-on-rails - Google 跨客户端授权和 invalid_grant 错误

我目前正在开发用于GoogleApi跨客户端授权的Web组件,如本文所述。https://developers.google.com/identity/protocols/CrossClientAuth此外,我所处的环境是Rails,因此我正在使用本文中描述的google-api-clientgemhttps://developers.google.com/identity/protocols/OAuth2WebServer#handlingtheresponse授权代码是通过Android应用程序使用Web客户端ID获取的,并传递到WebAPI以进行交换。我使用gem和代码兑换如下a

ruby - 如何在没有默认凭据文件的情况下授权 Google 服务帐户?

我有一个GoogleServiceAccount我的应用程序使用它从GoogleAnalytics检索数据。当我创建帐户时,我下载了一个client_secrets文件,其中包含通过OAuth授权所需的所有必要信息,并且我在名为GOOGLE_APPLICATION_CREDENTIALS的环境变量中记录了该文件的路径>根据Google'sdocumentation.我现在可以像这样获得经过身份验证的客户端:authorization=Google::Auth.get_application_default(scopes)此方法从文件中读取凭据,在本地工作,但我的应用程序托管在无法存储文

ruby-on-rails - rails console - 运行一段代码

我了解如何在Rails控制台中运行一段简单的代码。说Swimming::Student.create(:name="Jerry")我如何运行一大段代码(很多行)Swimming::Student.all.each{|student|student.attended=flasestudent.save} 最佳答案 如您所料,只需按回车键:$railscLoadingdevelopmentenvironment(Rails3.2.13)2.0.0p0:001>Student.all.eachdo|student|#enter2.0.0p

ruby-on-rails - 点击 Google Contacts API 时出现 "connection reset by peer"错误

我正在尝试使用GoogleContactsAPI将GoogleContacts拉入Rails应用程序。我已经完成了Oauth2握手,现在正在使用我的访问token请求protected资源。这是代码:uri=URI('https://www.google.com/m8/feeds/contacts/default/full')params={:client_id=>APP_CONFIG[:google_api_client_id],:access_token=>auth.access_token,"max-results".to_sym=>max_results}uri.query=U

ruby-on-rails - rails 2 : test 'link_to' and other view helpers from the rails console?

在Rails2中,我经常使用控制台,并且想知道使用它测试View助手(例如“link_to”或“url_for”)的最佳方法是什么。执行此操作的最佳方法是什么? 最佳答案 您可以将您的includeActionView::Helpers::UrlHelper添加到~/.irbrc以在您启动控制台时自动加载它。 关于ruby-on-rails-rails2:test'link_to'andotherviewhelpersfromtherailsconsole?,我们在StackOverfl

ruby-on-rails - 如何使用 Rails 和 Paperclip 在 Google Cloud Storage 上存储照片?

到目前为止,我一直在使用AmazonS3来存储用户的文件。这里需要做的是:为存储桶指定AmazonS3凭据添加'aws-sdk'gem到Gemfile在模型中:has_attached_file:avatar,:styles=>{:big=>"100x100#",:thumb=>"25x25#"},:storage=>:s3,:s3_credentials=>"#{Rails.root}/config/s3.yml",:path=>":rails_root/public/users/:id/:style/:basename.:extension",:url=>"/users/:id/:

ruby-on-rails - 使用 Google API 客户端,如何创建客户端

我正在努力使用GoogleAPI客户端:https://github.com/google/google-api-ruby-client具体来说,我想使用以下google_contacts_api.rb通过GoogleAPI客户端访问Google通讯录:https://gist.github.com/lightman76/2357338dcca65fd390e2我正在尝试像这样使用google_contacts_api.rb(x是有意的,实际上是正确的键):require'./lib/google_contacts_api.rb'auth=User.first.authenticati

ruby-gmail : Uncaught exception: 534-5. 7.14 <https ://accounts. google.com/ContinueSignIn?sarp=1&scc=1&plt=AKgnsbtMk

我可以手动登录我的帐户,但是当我使用ruby​​-gmail时,它会引发错误这是我的代码require'gmail'gmail=Gmail.new("myname@gmail.com","passwd")gmail.deliverdoto"rorocodeath@gmail.com"subject"HavingfuninPuertoRico!"text_partdobody"Textofplaintextmessage."endhtml_partdocontent_type'text/html;charset=UTF-8'body"Textofhtmlmessage."endadd_f

ruby - Google 使用 Ruby 进行应用程序开发吗?

有谁知道Google是否使用Ruby进行应用程序开发?与Perl或Python等其他语言相比,Ruby的总体工作前景如何? 最佳答案 Aaron大致是正确的。我们仅将C用于内核工作(以及其他用C编写的第3方内容的维护),因此我不会将其视为“应用程序开发”,而将ObjectiveC用于在Apple设备上运行客户端的应用程序的特定情况,等等Ruby是GoogleSketchup的嵌入式脚本语言,参见http://code.google.com/apis/sketchup/docs/gsrubyapi_examples.html--该决定