=== puma startup: 2015-05-19 17:04:50 +0800 ===
/usr/local/rvm/gems/ruby-2.0.0-p643/gems/puma-2.9.0/lib/puma/cli.rb:246:in initialize': No such file or directory - /home/mo1.0/tmp/pids/puma.pid (Errno::ENOENT)
from /usr/local/rvm/gems/ruby-2.0.0-p643/gems/puma-2.9.0/lib/puma/cli.rb:246:in
open'
from /usr/local/rvm/gems/ruby-2.0.0-p643/gems/puma-2.9.0/lib/puma/cli.rb:246:in write_pid'
from /usr/local/rvm/gems/ruby-2.0.0-p643/gems/puma-2.9.0/lib/puma/cli.rb:222:in
write_state'
from /usr/local/rvm/gems/ruby-2.0.0-p643/gems/puma-2.9.0/lib/puma/cluster.rb:332:in run'
from /usr/local/rvm/gems/ruby-2.0.0-p643/gems/puma-2.9.0/lib/puma/cli.rb:499:in
run'
from /usr/local/rvm/gems/ruby-2.0.0-p643/gems/puma-2.9.0/bin/puma:10:in <top (required)>'
from /usr/local/rvm/gems/ruby-2.0.0-p643/bin/puma:23:in
load'
from /usr/local/rvm/gems/ruby-2.0.0-p643/bin/puma:23:in <main>'
from /usr/local/rvm/gems/ruby-2.0.0-p643/bin/ruby_executable_hooks:15:in
eval'
from /usr/local/rvm/gems/ruby-2.0.0-p643/bin/ruby_executable_hooks:15:in `
唉,算了,我还是用 passenger 去吧,puma 好像一大堆人都说有 bug
root@hostname:/home/mo1.0# puma -e production -C config/puma.rb
[29743] Puma starting in cluster mode...
[29743] * Version 2.9.0 (ruby 2.0.0-p643), codename: Team High Five
[29743] * Min threads: 8, max threads: 32
[29743] * Environment: production
[29743] * Process workers: 3
[29743] * Preloading application
[29743] * Listening on unix:///home/mo1.0/tmp/puma.sock
[29743] Use Ctrl-C to stop
root@hostname:/home/mo1.0#
我把后台化的代码区掉了,结果如上,好像是没问题?? ps aux 也没有显示 puma 的进程 #2 楼 @huacnlee
class AddSubimagesToImages < ActiveRecord::Migration
def change
add_column :images, :subimages, :string, array: true, default: '{}'
end
end
z@z-270E5J-2570EJ:~/mo1.0$ rake db:migrate
== 20150502112546 AddSubimagesToImages: migrating =============================
-- add_column(:images, :subimages, :string, {:array=>true, :default=>"{}"})
-> 0.2366s
== 20150502112546 AddSubimagesToImages: migrated (0.2368s) ====================
#10 楼 @MrPasserby 好的,一直在看 ruby 的,没想到 js 这块还要设置
{"uptoken":"AK:BLABLA=:eyJzY29wZSI6Im1vc2l0ZSIsImRlYWRsaW5lIjoxNDI2MDY4MDEyfQ=="}
我照做后使用 new 方法,出现了一个页面,只有上面的 json 我怎么才能利用上这个 json 页面呢?
#6 楼 @MrPasserby 我新手。。。。不太明白 action 是什么意思?actioncontroller?但是在 views 里面的相应页面里#{uptoken}这个字符串输出就是 AK:blabla:blabla,不是 json 形式,而且我也是直接写了
input type="hidden" name="token" value="#{uptoken}"
作为上传的方法
#3 楼 @MrPasserby 我确实是这么写得,只不过没有渲染 json
# 在 imagecontroller 里面
def new
bucket = "myqiniuscope"
put_policy = Qiniu::Auth::PutPolicy.new(
bucket
)
uptoken = Qiniu::Auth.generate_uptoken(put_policy)
end
之后在 view 的相应页面使用表单上传,报了上面的“bad token”。。。。。我再好好想想吧
#2 楼 @xmonkeycn 没想到还会有这么具有教育意义的 demo,正想学 jq-file-upload 呢