草庐IT

file - 转到 : concatenate file contents

全部标签

ruby - Heroku 应用程序无法启动 - `require' : no such file to load -- sinatratestapp (LoadError)

我正在尝试使用bamboo-mri-1.9.2堆栈运行我的Heroku应用程序。当然,它在Ruby1.9.2上本地运行良好。但是在生产环境中,它在执行config.ru的启动过程中崩溃,如下所示:require'sinatratestapp'runSinatra::Application我的.gems文件:sinatra--version'>=1.0'应用程序本身为sinatratestapp.rb:require'rubygems'require'sinatra'get'/'do"HellofromSinatraonHeroku!"end这就是我在项目中得到的所有内容,并尝试在Her

ruby-on-rails - 重新归档 gem : multiple file uploads

我正在使用Refile和Rails4。我正在按照他们的教程进行multipleimageupload.每个帖子可以有多个图像。我的模型看起来像这样:后.rb:has_many:images,dependent::destroyaccepts_attachments_for:images,attachment::file图片.rb:belongs_to:postattachment:file我可以上传文件,使用:但是当我尝试检索像这样的图像时:我得到错误:undefinedmethodfilefor#如何使用多张图片上传来检索带有refile的图片? 最佳答案

ruby-on-rails - 在 RSpec 中使用 Ruby 1.9.2 需要 lib 带来 "no such file to load"

我正在尝试将我的一个Rails项目升级到Ruby1.9.2。一切进展顺利,但一个RSpec测试失败了。在这个测试中,我需要一个Rubylib:#filespec/models/my_lib_spec.rbrequire'spec_helper'require'lib/services/my_lib'describe"MyLib"doit"shoulddosomething"do...库看起来像这样:#filelib/services/my_lib.rbclassMyLibdefself.do_something...在Ruby1.8.7(REE)中测试运行良好:$ruby-vruby1

ruby-on-rails - Heroku 应用程序崩溃 H10 - bash : bin/rails: No such file or directory

这个问题在这里已经有了答案:"bin/rails:Nosuchfileordirectory"w/Ruby2&Rails4onHeroku(8个答案)关闭8年前。我的部署有问题。我的测试环境在本地运行良好,没有错误。当我推送到Heroku时,我得到了这个:2013-07-17T15:54:04.619297+00:00app[web.1]:bash:bin/rails:Nosuchfileordirectory2013-07-17T15:54:07.240398+00:00heroku[web.1]:Processexitedwithstatus1272013-07-17T15:54:

ruby - jruby -S bundle install jruby : No such file or directory -- bundle (LoadError)

我有我的ruby​​onrails应用程序,我已经在我的WindowsXP中安装了jruby-1.7.4。当我尝试运行jruby-Sbundleinstall时,它给我一个错误jruby:Nosuchfileordirectory--bundle(LoadError)我真的很纠结这个错误..请帮助.. 最佳答案 Bundler可能没有安装。您可以检查jruby-Sgemlist的输出来验证,然后安装它:jruby-Sgeminstallbundler一般来说,LoadError意味着您缺少gem依赖项。

ruby-on-rails - 回形针错误 : model missing required attr_accessor for 'avatar_file_name'

然后我想使用Paperclip为每个列表拍摄照片。我向listshow.html.erb、listing.rb模型、listings_controller.rb和_form.html.erb部分添加了适当的代码。当我尝试为list上传图片时出现此错误:Paperclip::ErrorinListingsController#updateListingmodelmissingrequiredattr_accessorfor'avatar_file_name'listings_controller的第44行:defupdaterespond_todo|format|if@listing.u

ruby-on-rails - ruby 包安装需要 : no such files to load error

我在通过git克隆的应用程序的bundleinstall安装gems时遇到了麻烦。这是bundleinstall的输出:bundleinstall/usr/lib/ruby/vendor_ruby/bundler/rubygems_ext.rb:8:in`require':nosuchfiletoload--rubygems(LoadError)from/usr/lib/ruby/vendor_ruby/bundler/rubygems_ext.rb:8from/usr/lib/ruby/vendor_ruby/bundler.rb:11:in`require'from/usr/lib

ruby - 导轨 : how to get a file extension/postfix based on the mime type

我的问题是,RubyonRails是否具有类似于以下的功能:file_content_type=MIME::Types.type_for(file).first.content_type这将返回特定mime类型的文件扩展名或后缀?所以如果我传入'image/jpeg'函数将返回'jpg'寻找一种比编写完成相同工作的case语句更简洁的编码方式。 最佳答案 Rack::Mime具有这种能力(Rack是Rails的依赖):require'rack/mime'Rack::Mime::MIME_TYPES.invert['image/jpe

ruby - 如何使用 Vim 从 do 跳转到 Ruby block 的末尾?

我正在使用vim进行ruby​​、php和perl开发。有快捷方式%可以从block(子例程/函数/方法/if)的开头跳转到结尾,反之亦然。对我来说,ruby中的do/end标记上的%不起作用。我如何用vim做到这一点? 最佳答案 matchitplugin允许匹配的不仅仅是括号和注释。可以找到ruby​​版本here. 关于ruby-如何使用Vim从do跳转到Rubyblock的末尾?,我们在StackOverflow上找到一个类似的问题: https://

ruby - 加载错误 : cannot load such file -- rspec/core/rake_task

当我rake的时候,我得到了这个错误。AllenLins-MacBook-Pro:geoblacklightallenlin$rake-tResolvingdependencies...Youmust`geminstallbundler`and`bundleinstall`torunraketasksrakeaborted!LoadError:cannotloadsuchfile--rspec/core/rake_task/Users/allenlin/Documents/USpatial/geoblacklight/Rakefile:12:in`require'/Users/alle