草庐IT

installed_date

全部标签

ruby-on-rails - 为什么每次使用 rvm 在 rails 3.2.1 中重启后都需要 "bundle install"?

出于某种原因,每次我重新启动计算机时,我都必须重做大量RubyonRails设置。我必须重做“bundle安装”以在我的Gemfile中安装所有gem,然后我必须使用“geminstallrails”重新安装rails,即使我通过RVM安装了rails。我在另一台具有其他设置的计算机上从未遇到过此问题,因此我不确定出了什么问题。下面是一些终端输出,希望能帮助人们调试出错的地方。$railsRailsisnotcurrentlyinstalledonthissystem.Togetthelatestversion,simplytype:$sudogeminstallrailsYoucan

ruby - 错误 : Error installing gollum: ERROR: Failed to build gem native extension

在通过rbenv全新安装rubyv2.2.2后,我无法安装gollum-wiki。我运行Ubuntu-Gnome14.04TrustyThar。这是安装日志:user@host:~/dev/drafts$geminstallgollumFetching:useragent-0.10.0.gem(100%)Successfullyinstalleduseragent-0.10.0Fetching:mustache-0.99.8.gem(100%)Successfullyinstalledmustache-0.99.8Fetching:rack-1.6.4.gem(100%)Success

ruby-on-rails - 昨天的 Rails : Formatting a date: "HH:MM" for today, "Yesterday",上周其他日子的 "Weekday",其他一切的 "DD.MM."

我确定已经有满足我需要的解决方案,但我想我不知道要搜索什么。有没有指向正确方向的指示?我在想像Rails的distance_of_time_in_words_to_now这样的东西。谢谢。 最佳答案 我相信您可以使用这样的助手。defcustom_format(date)ifdate==Date.today"Today"elsifdate==Date.yesterday"Yesterday"elsif(date>Date.today-7)&&(date没有测试代码,它只是指向您的问题的指针。

ruby - ActiveSupport::TimeWithZone#to_date 返回错误的日期

我想要来自ActiveSupport::TimeWithZone实例的日期部分。我为此使用了to_date函数,但它会提前一天返回日期。例如,如果日期时间是2012-04-1109:05:00UTC,如果我调用to_date然后它返回2012-04-10但2012-04-11。此外,我没有使用特定时区(默认为UTC)应用程序运行在Ruby1.8.7和Rails3.0.2谁能告诉我为什么它给出了错误的日期?如果有更好的方法从给定的DateTime(ActiveSupport::TimeWithZone的实例)获取日期(Date的实例)部分,也请建议我编辑:有人在这里也面临同样的问题htt

ruby-on-rails - Ruby 和 Rails "Date.today"格式

在IRB中,如果我运行以下命令:require'date'Date.today我得到以下输出:=>#但是在Rails控制台中,如果我运行Date.today,我会得到这个:=>Sat,26Sep2015我查看了Rails的Dateclass但找不到Rails的Date.today显示输出与Ruby的输出有何不同。谁能告诉我,在Rails中,Date.today或Date.tomorrow如何格式化日期以便更好地显示? 最佳答案 您问题的答案是ActiveSupport'scoreextensiontoDate类(class)。它覆盖

ruby-on-rails - 将 Date 和 1.month.ago 放在一起?

当我有一个名为:purchase_date的日期属性并想将它放在一起时,如何将Date和1.month.ago放在一起在类方法中?defself.last_month#Showonlyproductsoflastmonth.where(:purchase_date=>Date.today.1.month.ago.end_of_month..Date.1.month.ago.beginning_of_month)endconsole给出语法错误并将其删除Date.today与我的其他方法相比,结果为空白:defself.this_month#Showonlyproductsofthism

ruby - rvm 安装错误运行 'requirements_osx_port_install_port'

我试图在我的机器上安装rvm并选择一个版本,但是我收到了这个可怕的错误,有人可以帮忙吗?我需要安装蒲公英部署但由于这个问题无法安装。Errorrunning'requirements_osx_port_install_port',pleaseread/Users/mariovassiliades/.rvm/log/ruby-2.0.0-p0/1368093119_port_install.log 最佳答案 我通过先安装“Homebrew”解决了这个问题:ruby-e"$(curl-fsSLhttps://raw.github.com

ruby - OS X 优胜美地 : Impossible to install cocoapods

我有ruby​​版本:ruby2.1.2p95(2014-05-08修订版45877)[x86_64-darwin13.0]当我尝试安装cocoapods时,我得到:$sudogeminstallcocoapods-VERROR:Couldnotfindavalidgem'cocoapods'(>=0),hereiswhy:Unabletodownloaddatafromhttps://rubygems.org/-nosuchname(https://api.rubygems.org/latest_specs.4.8.gz)GEThttps://api.rubygems.org/pre

ruby-on-rails - gem install libv8 -v '5.3.332.38.1' ... 安装 libv8 : ERROR: Failed to build gem native extension 时出错

有什么想法/建议吗?****进一步更新:****2.3.1agxxx-xxxight2290-fix-claim-button%ruby​​-e'putsGem::Platform.local'x86_64-darwin-13我有2台机器,我正在尝试在其上安装libv8...,现在出现相同的错误(不管darwinv.)1一个mac桌面(使用x86_64-darwin-13,另一个使用darwin-16)。最初,我认为问题与darwin-13有关,但现在无论如何都会遇到同样的问题)。我尝试了多种解决方案,包括重新安装和升级OSX和xcode。MacOXSierra10.12.3xcode

ruby - 如何通过 Gemfile 到 "gem install nokogiri -- --use-system-libraries"

安装最新版本的Nokogiri时出现已知错误。解决方法是使用手动安装geminstallnokogiri----use-system-libraries但是这如何通过Gemfile完成呢? 最佳答案 运行bundleconfigbuild.nokogiri--use-system-libraries运行此命令后,每次Bundler需要安装nokogirigem时,它都会传递您指定的标志。它通过在你的~/.bundle/config文件中添加一个条目来记住这个设置:---BUNDLE_BUILD__NOKOGIRI:"--use-sy