草庐IT

global-require

全部标签

ruby - `require' : cannot load such file -- HTTParty (LoadError)

首先,我是Ruby的新手,我正在学习https://www.distilled.net/resources/web-scraping-with-ruby-and-nokogiri-for-beginners/上的简单教程。我有一个包含以下内容的test.rb文件:require'rubygems'require'Nokogiri'require'HTTParty'require'Pry'require'csv'#thisishowwerequestthepagewe'regoingtoscrapepage=HTTParty.get('https://newyork.craigslist

ruby - rvm、irb 和 require - 不适用于 irb 下已安装的 gem

我今天刚刚安装了rvm,它看起来非常方便/强大。我想我已经掌握了窍门,但是......当使用安装了rvm的ruby​​并运行irb时,当我需要安装的gem时,比如“rvm”,我得到:>kimptoc$rvmuse1.8.7Using/Users/kimptoc/.rvm/gems/ruby-1.8.7-p302>kimptoc$gemlist***LOCALGEMS***abstract(1.0.0)...rvm(1.0.11)...>kimptoc$irbruby-1.8.7-p302>require'rvm'LoadError:nosuchfiletoload--rvmfrom(i

ruby-on-rails - Bundler.require 不适用于我的 gem 中的 ActiveRecord

我刚刚创建了一个新的gem(使用bundler)并想添加ActiveRecord支持。所以我将s.add_dependency"activerecord","~>3.0"添加到我的gemspec中。然后我使用Bundler.setup和Bundler.require并认为我现在可以访问ActiveRecord,但我没有。我必须明确使用require"active_record"。知道为什么Bundler.require在那种情况下对我不起作用吗? 最佳答案 首先,如果您要打包gem,donotuseBundler.require.B

轨道上的 ruby 。调度.fcgi 。 dependencies.rb :251:in `require' : cannot load such file -- fcgi (LoadError)

app=redmine-2.0.1ruby=ruby​​1.9.3p194(2012-04-20修订版35410)[x86_64-linux][root@by1016690public]#./dispatch.fcgi/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in`blockinrequire':iconvwillbedeprecatedinthefuture,useString#encodeinstead./usr/local/lib/r

ruby - Ruby 中的 'require' 是否不自动包含子文件夹?

如果我有这个文件夹结构:rexmlrexml/document下面的语法不是递归引用吗?require'rexml'或者如果我还想访问'document'中的内容,我是否需要编写以下内容?:require'rexml/document'我感到困惑的原因是我看到一些代码,其中作者一个接一个地写了两个require语句:require'rexml'require'rexml/document'我不确定这是否真的有必要。 最佳答案 Ruby的标准require只加载Ruby文件,不加载文件夹或其他任何东西。当您说“需要‘rexml’”时,

ruby - "Error installing charlock_holmes": "icu required"

我试图在我的Mac(10.7.5、ruby-1.9.3-p392)上安装charlock_holmes,但我遇到了以下错误:$geminstallcharlock_holmes-v'0.6.9.4'Buildingnativeextensions.Thiscouldtakeawhile...ERROR:Errorinstallingcharlock_holmes:ERROR:Failedtobuildgemnativeextension./Users/mthompson/.rvm/rubies/ruby-1.9.3-p392/bin/rubyextconf.rbcheckingform

css - Ruby 无法找到 Foundation/foundation-global?

昨天,我决定在我的一个网络应用程序上试用Foundation。一切正常,就像我在localhost中一样,但是当我将新更改推送到我的EC2实例时,继续遵循ZurbFoundation说明,我遇到了这个错误:Sass::SyntaxErrorinHome#indexShowing/var/www/brain_db/app/views/layouts/application.html.erbwhereline#18raised:Filetoimportnotfoundorunreadable:foundation/foundation-global.Loadpath:Sass::Rails

ruby-on-rails - 是否可以将 globalize3 添加到外部 ActiveRecord 模型类?

我有一个项目,我正在为其使用globalize3gem以允许使用多种语言。在我自己的模型中,我只需添加'translatesfield1,field2,etc.'和适当的迁移,一切都很好。问题是我还有一些依赖于外部gem的功能。对于其中一些模型,我也想添加全局化。我没有模型的代码可以像我对其他模型那样直接修改。重新打开模型似乎不起作用。有没有办法将翻译行添加到我无法直接访问的模型?我正在使用Rails3.1和Ruby1.9.2以防万一。 最佳答案 您能否提供gem的名称和该gem的模型?类是否在模块下命名空间?如果是这样,您可能没有

ruby-on-rails - rails3,过滤器链停止为 :require_no_authentication rendered or redirected

我的设计有问题。当用户已经登录,然后点击登录链接时,没有任何反应,但我的终端输出如下:Filterchainhaltedas:require_no_authenticationrenderedorredirected这发生在我要ProcessingbySessionsController#newasHTML有什么办法,如果有登录用户,我如何告诉设计转到after_sign_in_path?这是我的登录后路径defafter_sign_in_path_for(resource)ifsession[:user_return_to]return_to=session[:user_return

ruby-on-rails - 使用 linkedin 凭据登录时出现 Oauth 登录错误 ("error":"https_required")

我正在使用omniauth-linkedin-oauth2(1.0.0)gem使用linkedin将用户登录到我们的网站,它工作正常,直到现在我不确定它是否与linkedinAPI更改相关或什么我收到以下错误|(linkedin)Authenticationfailure!invalid_credentials:OAuth2::Error,https_required:Theclientisnotauthorized{"error":"https_required","error_description":"Theclientisnotauthorized"}这是我的配置:OmniAu