草庐IT

app-bundle-name

全部标签

ruby-on-rails - 在 Apache 下的子目录中配置 Ruby On Rails App

我在Windows上安装了apache2.2。我正在尝试同时提供颠覆(/svn)和redmine(/redmine)。我的svn使用此配置运行良好:DAVsvnSVNParentPathC:/svn_repository...这很好用——我的svn用户可以点击http://mybox/svn就好了。现在我想为Rails应用程序(RedMine)添加另一个目录:我遵循了thisquestion中的建议设置杂种服务器并让apache代理客户端连接到它。如果我将它设为根目录,它工作正常——但我在将它设为子目录时遇到了问题:ProxyPasshttp://localhost:3000/Prox

ruby-on-rails - 知道@vendor.name 后如何使 Ruby on Rails 中的 URL 对 SEO 友好?

我的应用程序在RoR中我有一个名为showsummary的操作/View,其中ID已传递到URL,并且Controller使用它来实例化@vendor,其中@vendor.name是公司的名称。我希望URL是showsummary/1/而不是在URL中包含/vendor-name。我该怎么做? 最佳答案 所有这些解决方案都使用find_by_name,这肯定需要在该列上有一个索引并且要求它们是唯一的。我们使用的一个更好的解决方案是在供应商名称前加上其ID,但牺牲了一点美观。这意味着您不必在名称列上有索引和/或要求唯一性。供应商.rb

ruby - 使用 JRuby 或 bundle exec 时如何使用 rspec 启用颜色?

我正在尝试使用JRuby运行我的rspec:rakespec结果是:jruby-Sbundleexecrspec--colorspec/foo_spec.rb没有颜色出现,所以我从等式中删除了Jruby:bundleexecrspec--colorspec/foo_spec.rb没有颜色。如何将“--color”选项传递给rspec?我的项目的根目录中还有一个.rspec文件,在这些情况下似乎没有帮助。然而,.rspec文件在我刚刚运行时被拾取或使用:rspecspec/foo_spec.rb有什么想法吗? 最佳答案 将--tty添

ruby - Rvm:无法卸载 bundle 程序 1.1.0

我有一个rails3.0.2项目我想安装,尽管我的大多数新项目都是3.2+我去运行bundleinstall并收到以下消息:Bundlercouldnotfindcompatibleversionsforgem"bundler":InGemfile:rails(=3.0.2)rubydependsonbundler(~>1.0.0)rubyCurrentBundlerversion:bundler(1.1.0)ThisGemfilerequiresadifferentversionofBundler.PerhapsyouneedtoupdateBundlerbyrunning`gemi

ruby - 是 &method( :method_name) idiom bad for performance in Ruby?

我最近遇到了&method(:method_name)语法。(这使用Object#method方法-RDoclink)例如,[5,7,8,1].each(&method(:puts))相当于[5,7,8,1].each{|number|putsnumber}在Ruby的各种实现中,与前者相比,后者是否存在性能损失?如果是,实现者是否正在努力提高其性能? 最佳答案 是的,这似乎对性能不利。deftimestart=Time.nowyield"%.6f"%(Time.now-start)enddefdo_nothing(arg)endR

ruby - 未安装 gem 时如何从 require "gem_name"中解救

我正在编写一个依赖于特定gem的库。我需要gem并在我的代码中使用它,只要在用户的机器上安装了gem,一切都很好。但如果不是呢?!我认为这很好,因为我可以从require命令中解救出来并向输出打印一条消息以通知用户缺少gem并优雅地完成它,但我收到错误!你能告诉我应该怎么做或者这段代码有什么问题吗:beginrequire"some_gem"rescueputs"pleaseinstallsome_gemfirst!"end 最佳答案 如果require无法加载所需的库,则会引发LoadError异常。但是,您从不在任何地方从Loa

ruby - Bundle 安装在 ruby​​ 2.0 升级时损坏

刚刚升级到ruby​​2.0/rails4.0并尝试在新的rails项目上运行bundleinstall。每当它遇到尚未安装的东西时,它就会吐出:Installingcoffee-rails(4.0.0.beta1)Errno::ENOENT:Nosuchfileordirectory-/usr/lib/ruby/gems/2.0.0/build_info/coffee-rails-4.0.0.beta1.infoAnerroroccurredwhileinstallingcoffee-rails(4.0.0.beta1),andBundlercannotcontinue.Makesu

ruby-on-rails - 无法在 Rails 4 中使用 bundle install 命令安装 capybara-webkit

在我的Rails4应用程序中执行命令bundleinstall时出现以下错误。>ruby-vruby2.1.8p440(2015-12-16revision53160)[i386-mingw32]>rails--versionCouldnotfindgem'capybara-webkitx86-mingw32'inanyofthegemsourceslistedinyourGemfileoravailableonthismachine.Run`bundleinstall`toinstallmissinggems.我的Gemfile........group:development,:l

ruby - 为什么 bundle 更新后 gem 仍然过时

我正在开发一个gem,它在github上。当我在应用程序中包含gem时,进行capistrano部署,然后(在服务器上)运行:bundleoutdated我明白了:*authengine(0.0.1d8baa49>0.0.1de43dfa)这告诉我有更新的提交可用。为什么bundle更新(capistrano部署的一部分)不提取更新的版本?宿主应用程序的Gemfile中没有版本限制,无论如何它们具有相同的版本号,只是不同的提交。即使我登录服务器并运行bundleupdateauthengine之后我得到了相同的“过时”结果。我在这里缺少什么? 最佳答案

ruby-on-rails - `add_route' : Invalid route name, 已在使用中:'root' (ArgumentError)

我使用的是rails4.1.1和ruby​​2.1.1,我在设计方面遇到了问题,即我的路线。我以前用过很多次devise_for:usersget'pages/index'#RoutetoDeviseLoginPagedevise_scope:userdorootto:"devise/sessions#new"end#Directingtheuserafterloginauthenticated:userdoroot:to=>'pages#index'end但是我得到了错误`add_route':Invalidroutename,alreadyinuse:'root'(Argument