标签: ruby

什么是Rack中间件?

什么是Ruby中的Rack中间件?对于"中间件"的含义,我找不到任何好的解释.

ruby rack web-applications ruby-on-rails http

260
推荐指数
7
解决办法
6万
查看次数

Ruby - 测试数组

什么是正确的方法:

is_array("something") # => false         (or 1)

is_array(["something", "else"]) # => true  (or > 1)
Run Code Online (Sandbox Code Playgroud)

或者计算其中的物品数量?

ruby syntax

259
推荐指数
7
解决办法
20万
查看次数

通过迁移向列添加默认值

如何向通过迁移已存在的列添加默认值?

我可以找到的所有文档都向您展示了如果列尚不存在但是在这种情况下它是如何实现的.

ruby migration ruby-on-rails

259
推荐指数
7
解决办法
15万
查看次数

在Ubuntu上sqlite3-ruby安装错误

我在sqlite3-ruby安装期间出现以下错误:

Building native extensions.  This could take a while...
ERROR:  Error installing sqlite3-ruby:
    ERROR: Failed to build gem native extension.

/usr/bin/ruby1.8 extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Try 'port install sqlite3 +universal' or 'yum install sqlite3-devel'
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog …

ruby sqlite ubuntu sqlite3-ruby

258
推荐指数
6
解决办法
9万
查看次数

print和puts有什么区别?

例如,在这行代码我写的,printputs产生不同的结果.

1.upto(1000).each { |i| print i if i % 2 == 0 }
Run Code Online (Sandbox Code Playgroud)

ruby

258
推荐指数
4
解决办法
27万
查看次数

如何找到安装gem文件的位置?

我可以通过命令找到安装了哪个gem gem list,但它没有告诉我gems的安装位置.

我怎样才能找到宝石的位置,如何在安装宝石之前知道它?

ruby rubygems

257
推荐指数
8
解决办法
20万
查看次数

运行单个迁移文件

有一种简单的方法来运行单个迁移吗?我不想迁移到某个版本,我只想运行一个特定的版本.

ruby migration ruby-on-rails

253
推荐指数
10
解决办法
14万
查看次数

PG :: ConnectionBad - 无法连接到服务器:连接被拒绝

每次我运行我的rails 4.0服务器,我得到这个输出.

Started GET "/" for 127.0.0.1 at 2013-11-06 23:56:36 -0500

PG::ConnectionBad - could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (fe80::1) and accepting
TCP/IP connections on port 5432?
: …
Run Code Online (Sandbox Code Playgroud)

ruby database-connection ruby-on-rails pg rails-postgresql

253
推荐指数
15
解决办法
22万
查看次数

Ruby,从字符串中删除最后N个字符?

n从字符串中删除最后一个字符的首选方法是什么?

ruby string

252
推荐指数
9
解决办法
19万
查看次数

如何将对象的字段转储到控制台?

当我运行一个简单的Ruby脚本时,将对象的字段转储到控制台的最简单方法是什么?

我正在寻找类似于PHP的东西print_r(),它也适用于数组.

ruby printf-debugging

250
推荐指数
8
解决办法
17万
查看次数