草庐IT

INTEGRAL_CONSTANT

全部标签

ruby - 名称错误 : uninitialized constant MIME

这行ruby​​press代码::type=>MIME::Types.type_for(FILENAME).first.to_s,出现以下错误:NameError:uninitializedconstantMIME整个block是:FILENAME='myFile.png'wp.uploadFile(:data=>{:name=>FILENAME,:type=>MIME::Types.type_for(FILENAME).first.to_s,:bits=>XMLRPC::Base64.new(IO.read(FILENAME))})有什么问题的建议吗? 最

ruby-on-rails - 名称错误 : uninitialized constant Smtpapi

我正在尝试将我的代码推送到Heroku,但构建失败了NameError:uninitializedconstantSmtpapi/tmp/build_0ce2a697c4ef6c16626b01b82d9463f3/app/helpers/my_mailer_header.rb:1:in`'/tmp/build_0ce2a697c4ef6c16626b01b82d9463f3/lib/api_v1/users.rb:3:in`'/tmp/build_0ce2a697c4ef6c16626b01b82d9463f3/lib/api_v1/mymedical.rb:3:in`'/tmp/b

ruby - 是什么导致了 "already initialized constant"警告?

我的代码有什么问题?FileNameArray是否被重用?f.rb:17:警告:已初始化常量FileNameArraynumber=0whilenumber 最佳答案 你可能是ruby​​初学者,我尝试用ruby​​方式重写相同的代码......(1..99).eachdo|number|Dir.glob("/home/product/"+("%04d"%numbers)+"/*/*.txt").eachdo|file_name|File.open(file_name,"r:utf-8").eachdo|txt|nextunless

ruby-on-rails - rails : Grape API - NameError: uninitialized constant API

我目前正在学习如何使用Rails。我遵循了本网站上的教程:http://funonrails.com/2014/03/building-restful-api-using-grape-in-rails/我没有将文件放在lib文件夹中,而是放在app文件夹中,并按照教程中的说明编辑了application.rb。其余代码与教程中的相同。我在自定义错误格式化程序之前完成了它,但是如果我启动Rails服务器来测试所有内容,我会收到以下错误:ExitingE:/Users/Robert/Documents/RubymineProjects/WarframeApi/config/routes.r

ruby-on-rails - Rails has_many :through Uninitialized constant

我正在寻找有关调试Railshas_many:through关联问题的帮助。我有3个模型,Package、Venue和我的连接表Packagevenuepackage.rbclassPackage地点.rbclassVenuepackagevenue.rbclassPackagevenuepackagevenues表的架构create_table"packagevenues",force::cascadedo|t|t.integer"package_id"t.integer"venue_id"t.datetime"created_at",null:falset.datetime"upd

ruby - "uninitialized constant OpenSSL::PKey::EC"来自 CentOS 6.6 上的 Ruby

我有一个使用openid_connectgem的Rails服务器应用程序。当我尝试在CentOS6.6上运行它时,我得到:uninitializedconstantOpenSSL::PKey::EC这是完整的堆栈跟踪:$railsserver/home/foo/.rvm/gems/ruby-2.1.3/gems/json-jwt-1.5.1/lib/json/jwk/jwkizable.rb:69:in`':uninitializedconstantOpenSSL::PKey::EC(NameError)from/home/foo/.rvm/gems/ruby-2.1.3/gems/j

ruby - rhc 安装程序返回 "warning: constant::TimeoutError is deprecated"

环境Ubuntu16.04xenialLinux内核:4.4.0-22-genericruby--versionruby2.3.0p0(2015-12-25)[x86_64-linux-gnu]复制步骤sudoapt-getinstallruby-fullrhcsetup返回:/var/lib/gems/2.3.0/gems/commander-4.2.1/lib/commander/user_interaction.rb:328:warning:constant::TimeoutErrorisdeprecated上传default公钥后,显示:Checkingforgit...fou

ruby-on-rails - 名称错误 : uninitialized constant

我在Rails中进行单元测试......这是我的代码位于test\unit\sample_test.rbrequire'test_helper'require'test/unit'require'sample'classSampleTest我的app\models\sample.rb包含以下内容..,classSampledefassert_student(student)#assert_equal"123",student.external_reference"#{student_id}"endend当我运行“raketest:units”时,它显示了以下错误test_student

ruby rubocop : how to freeze an array constant generated with splat

我正在分配一个这样的数组常量:NUMS=*(2..9)Rubocop说C:卡住分配给常量的可变对象。NUMS=*(2..9)^^^^^所以我试试NUMS=*(2..9).freezeRubocop说C:卡住分配给常量的可变对象。NUMS=*(2..9).freeze^^^^^^^^^^^^尝试过NUMS=(*(2..9)).freezeRubocop说E:意外的标记tRPAREN(使用Ruby2.0解析器;在AllCops下使用TargetRubyVersion参数进行配置)NUMS=(*(2..9)).freeze^尝试过NUMS=[1,2,3,4,5,6,7,8,9].freeze

sql - rails : NameError: uninitialized constant on join table

我似乎无法解决名称约定问题,或者我是否错误地加入了它们。这是我从用户模型中得到的错误:>user.companiesNameError:uninitializedconstantUser::CompaniesUser从公司模型来看:>company.usersNameError:uninitializedconstantCompany::CompaniesUser用户.rbhas_many:companies_usershas_many:companies,:through=>:companies_users公司.rbhas_many:companies_usershas_many:u