草庐IT

script_location

全部标签

ruby-on-rails - 我该怎么办 :remote location validation with CarrierWave?

我在我的Rails3示例应用程序上使用CarrierWave。我想验证远程位置上传,因此当用户提交无效URL(空白或非图像)时,我不会收到标准错误异常:CarrierWave::DownloadErrorinImageController#createtryingtodownloadafilewhichisnotservedoverHTTP这是我的模型:classPaintingtrue,:length=>{:minimum=>5,:maximum=>100}validates:image,:presence=>trueend这是我的Controller:classPaintingsC

ruby-on-rails - bundler : not executable: script/delayed_job

我正在尝试在我的远程服务器上运行以下命令(通过capistrano或ssh):bundleexecRAILS_ENV=productionscript/delayed_jobstart但我收到此错误消息:bundler:notexecutable:script/delayed_job以前从未见过这个,谷歌也没有适合我的东西。知道可能是什么问题吗? 最佳答案 也许它没有运行权限?尝试运行这个命令chmod+xscript/delayed_job然后再次执行文件。 关于ruby-on-rai

ruby - 混帐 & ruby : How can I unset the GIT_DIR variable from inside a ruby script?

我编写了一个非常简单的“部署”脚本,作为我的裸git存储库中的post-updateHook运行。变量如下livedomain=~/mydomain.comstagingdomain=~/stage.mydomain.comgitrepolocation=~/git.mydomain.com/thisrepo.git(bare)core=~/git.mydomain.com/thisrepo.gitcore==addedremoteintoeachlive&stagegitslive和stage都初始化了gitrepos(非裸),我已经将我的裸仓库作为远程添加到它们中的每一个(名为co

ruby-on-rails - 在任何来源中都找不到 coffee-script-source-1.1.3

您好,我正在做Rails应用程序,当我捆绑安装时它返回一个错误:无法在任何来源中找到coffee-script-source-1.1.3我知道coffee-script-source-1.1.3gem已被弃用/取消,但我的其他gem与此有依赖关系。但是这个项目正在与其他机器和heroku产品一起工作。如何在不更改我的gemfile的情况下成功捆绑安装?谢谢 最佳答案 运行这个:bundleupdate--sourcecoffee-script-source如果出现错误,如下所示:Anerroroccurredwhileinstall

ruby 'script = $0'

我在查看Ruby脚本时遇到了script=$0。我做了一些谷歌搜索,但我还没有找到关于它的作用的明确答案。我相信它可以防止您读取大于内存的文件,对吗?谢谢,我在下面有完整的脚本,因此您可以在上下文中查看它:#Takesthenameofafileasanargumentandassignstofilenamefilename=ARGV.firstscript=$0puts"We'regoingtoerase#{filename}."puts"Ifyoudon'twantthat,hitCTRL-C(^C)."puts"Ifyoudowantthat,hitRETURN."print"?

ruby-on-rails - Geocoding API 的响应不是有效的 JSON。和 request.location = nil

ifRails.env.development?@current_location_geo=Geocoder.search(request.remote_ip).firstelse@current_location_geo=request.locationendif!@current_location_geo.nil?&&@current_location_geo.ip=="127.0.0.1"@departure_currency_code="AUD"@departure_currency_name=["AustralianDollar(AUD$)","AUD"]else@count

ruby-on-rails - vim/macvim : locate where a method/symbol is defined

我的大部分Ruby+RubyonRails开发都使用macvim/vim。目前是否有一种方法可以跳转到项目中定义方法的位置,即使它与调用它的位置不在同一个文件中?与语言无关的方式或特定于Ruby/Rails的方式均可。 最佳答案 我推荐使用ctags插件,BryanLiles制作了一个很好的截屏视频,介绍如何在Rails开发中使用它。http://smartic.us/2009/04/05/using-ctags-in-vim/来自他的页面:不那么完整的备忘单:^]–查找标签^T——倒退:tags–显示你去过的地方:tag–进入你的

ruby-on-rails - rails : wkhtmltopdf RuntimeError (Location of wkhtmltopdf unknown)

我正在使用Ubuntu11.04在RubyonRails中开发一个应用程序。在应用程序中,我需要生成pdf文档。所以我正在使用wicked_pdf和wkhtmltopdf二进制gem。在我系统的开发环境中,一切正常。但是一旦我使用Phusion在CentOS5.6上部署应用程序乘客,当我尝试动态生成pdf时,出现以下错误:RuntimeError(wkhtmltopdf位置未知)我正在使用Ruby1.9.2.p136rails3.1.1任何帮助将不胜感激......谢谢。 最佳答案 另一种方法是通过Gemfile安装二进制文件。只需

ruby-on-rails - "ruby script/plugin"是命令吗?

我按照在线教程在AppEngine上创建RubyonRails应用程序。有一个其他人可以运行的命令,但它没有在我的Ubuntu10.10上运行:rubyscript/plugininstallhttp://svn.avdi.org/nulldb/trunk/当我尝试运行它时,它会提示:ruby1.8:Nosuchfileordirectoryscript/plugin(LoadError)我的电脑出了什么问题?ruby-v==>1.8.7rails-v==>2.3.10gem-v==>1.3.7 最佳答案 如果使用rails3,cd

ruby-on-rails - Vagrant/VirtualBox VM 配置 : rbenv installs successfully but subsequent uses in script fail

我正在使用Vagrant+VirtualBox为我的Rails应用设置虚拟机。我正在清理Vagrantfile中引用的.sh配置脚本,如下所示:config.vm.provision"shell",path:"script/provision-script.sh"配置脚本做了很多事情,但最后它应该安装rbenvRuby版本控制,然后使用rbenv安装Ruby2.2.1。供应脚本的那部分看起来像这样:echo"settinguprbenv"#executetheremainingcommandsasvagrantuser,insteadofrootsudo-H-uvagrantbash-