以前我订购过我的帖子:
@posts = Post.find(:all, :order => "created_at DESC")
Run Code Online (Sandbox Code Playgroud)
但是现在我想created_at
用我在Post模型中编写的自定义方法替换它给出一个数字作为结果.
我猜:
@posts = Post.find(:all, :order => "custom_method DESC")
Run Code Online (Sandbox Code Playgroud)
哪个失败..
我以前能够上传文件但是最后一天我无法将文件上传到我的S3
当我尝试从控制台上传文件时
Document.create(remote_file_url: 'http://www.pdf995.com/samples/pdf.pdf')
Run Code Online (Sandbox Code Playgroud)
我明白了
Document.create(remote_file_url: 'http://www.pdf995.com/samples/pdf.pdf')
(0.1ms) BEGIN
SQL (0.7ms) INSERT INTO "documents" ("created_at", "file", "updated_at") VALUES ($1, $2, $3) RETURNING "id" [["created_at", Thu, 12 Feb 2015 22:33:59 EST -05:00], ["file", "pdf.pdf"], ["updated_at", Thu, 12 Feb 2015 22:33:59 EST -05:00]]
(0.2ms) ROLLBACK
Excon::Errors::SocketError: Bad address
from /Users/xxxx/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/openssl/buffering.rb:375:in `syswrite_nonblock'
from /Users/xxxx/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/openssl/buffering.rb:375:in `write_nonblock'
from /Users/xxxx/.rvm/gems/ruby-2.0.0-p247@sites/gems/excon-0.13.4/lib/excon/socket.rb:113:in `write'
from /Users/xxxx/.rvm/gems/ruby-2.0.0-p247@sites/gems/excon-0.13.4/lib/excon/connection.rb:243:in `request_kernel'
from /Users/xxxx/.rvm/gems/ruby-2.0.0-p247@sites/gems/excon-0.13.4/lib/excon/connection.rb:97:in `request'
from /Users/xxxx/.rvm/gems/ruby-2.0.0-p247@sites/gems/fog-1.3.1/lib/fog/core/connection.rb:20:in `request'
from /Users/xxxx/.rvm/gems/ruby-2.0.0-p247@sites/gems/fog-1.3.1/lib/fog/aws/storage.rb:359:in `request'
from /Users/xxxx/.rvm/gems/ruby-2.0.0-p247@sites/gems/fog-1.3.1/lib/fog/aws/requests/storage/put_object.rb:35:in `put_object'
from /Users/xxxx/.rvm/gems/ruby-2.0.0-p247@sites/gems/fog-1.3.1/lib/fog/aws/models/storage/file.rb:133:in `save'
from /Users/xxxx/.rvm/gems/ruby-2.0.0-p247@sites/gems/fog-1.3.1/lib/fog/core/collection.rb:50:in `create'
from /Users/xxxx/.rvm/gems/ruby-2.0.0-p247@sites/gems/carrierwave-0.10.0/lib/carrierwave/storage/fog.rb:261:in `store'
from …
Run Code Online (Sandbox Code Playgroud) 有没有人有一个很好的方法来使用MsBuild或Nant构建MSI(vdproj)项目?
我知道一个答案是在构建服务器上安装Visual Studio并使用devenv.exe来构建项目,但是,我不想在构建服务器上安装Visual Studio.
我整天都在使用Cucumber,即使我没有更改任何文件,它也停止了工作.
它给出了一个错误,内容如下:
Unable to either launch or connect to Chrome. Please check that ChromeDriver is up-to-date. Using Chrome binary at: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome (Selenium::WebDriver::Error::UnknownError)
有什么想法,发生了什么事?
我正在写一个Rails engine
但我不知道如何扩展我的config/application.rb
我想我必须以任何方式得到应用程序名称的任何想法?
require File.expand_path('../boot', __FILE__)
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env)
module application_name
class Application < Rails::Application
end
end
Run Code Online (Sandbox Code Playgroud) 我试图能够使用ruby中的selenium webdriver从gmail桌面通知中获取数据
我有一些Haml部分,其中许多包含样板
.container
.row
.col-lg-12
当我试图从ala中抽象出来时= partial "site_section"
,我得到:
syntax error, unexpected keyword_end, expecting end-of-input end;end;end;end
Run Code Online (Sandbox Code Playgroud)
我正在使用ruby 2.2.2.
如何在Middleman的Haml部分内渲染出Haml?
谢谢
更新 这显然是某种特殊情况处理我的部分(上图).我有其他部分内部部分渲染就好了.
更新 关于这个repo,布局实际上是:
_site_section:
.container
.row
.col-lg-12
_nested_section:
= partial "site_section"
MOAR (nested) HAML
Run Code Online (Sandbox Code Playgroud)
index.haml:
=partial "nested_section"
在2010年中期,我找到了一个名为PHPToCLib的类库.它运行了一年多的完美 - 我能够将大量自己的自定义代码实现到我可以从我的CMD提示符运行的AIM Bot中.但是,在2011年底,服务器停止响应脚本.它连接到端口5190上的toc.oscar.aol.com,并且尚未更改.我确实知道AOL停止了他们的TOC2服务器,并且不再可能与它们连接.但是,我下载了一个名为TerraIM的程序,该程序使用相同的规范,并以某种方式连接到它们.我想知道是否有关于如何连接脚本的更新,如果是,我需要更改什么?
先感谢您.
我有一个非根的双向未加权非二叉树.我知道如何找到树的直径,树中任何一对点之间的最大距离,但我有兴趣找到具有该最大距离的对的数量.是否有算法可以找到直径距离优于O(V ^ 2)时间的对数,其中V是节点数?
谢谢!
任何人都可以让我知道node.js应用程序的构建定义应该如何?另外如何在自动化测试中提及摩卡测试?
我第一次尝试排队时,我得到一个错误说:
找不到Microsoft.NodejsTools.targets.
所以我去NodejsTools
了我的构建服务器中复制带有.target和dll文件的文件夹.我没有看到错误.
现在我得到以下错误:
C:\ Program Files(x86)\ MSBuild\Microsoft\VisualStudio\v11.0\WebApplications\Microsoft.WebApplication.targets(132):无法复制文件"obj\Debug\OstNodeJs.exe",因为找不到它.