huobazi/carrierwave-qiniu

rails 4 .1.8

yongqianme opened this issue · 14 comments

config.qiniu_bucket_private= true #default is false

config.qiniu_protocol = "http"

这两个找不到

@你用的哪个版本?

没有指定版本,就是最新的吧?

发自我的 iPhone

在 2015年1月4日,上午8:48,Marble Wu notifications@github.com 写道:

@你用的哪个版本?


Reply to this email directly or view it on GitHub.

@brucebot 看看你的 Gemfile.lock 里的 carrierwave-qiniu 版本号,或者你附一下 Gemfile,我测试一下。

是这个版本 carrierwave-qiniu (0.0.7.1)

我刚看了目前的版本是0.1.6,看来需要指定一下github这个

@brucebot 0.0.7.1 是比较早的版本了,不含这两项配置的。
另外 0.1.6 属于被 yank 的版本,直接 bundle install 不上的, see http://rubygems.org/gems/carrierwave-qiniu/versions
因为 qiniu 官方的 sdk在 的 mime-type 的依赖上 和 rails 4.1.5 一下的版本冲突,在等待 qiniu 修复,你用 rails 4.1.8 应该影响不到的,可以用 0.1.5 或者 用 github的代码
see also:
qiniu/ruby-sdk#115
7895178
#20

指定了版本,后保存数据的时候出现问题了,错误是
undefined method `[]=' for nil:NilClass

很奇怪的问题,我改成aliyun的就可以了,目前在用0.1.6

@brucebot 报错的系统环境 ruby 版本 和 不报错的 aliyun 上分别是什么呢?

ruby 是2.1.5版本,

carrierwave-aliyun (0.3.3)
carrierwave (>= 0.5.7)
rest-client (>= 1.6.7)

你所说的 aliyun 是指存储啊,我以外是 vps,晕。
能贴一下报错的堆栈么?

不好意思,因为一直在出错,就暂用本地在测试其他的,最近其他的完成,又来测试这个了,报错是

Parameters:

{"utf8"=>"✓",
 "authenticity_token"=>"/s8OEiJBC/OA4MSBYI7uersFCAjfvzoC3w+8OoKfzgQ=",
 "video"=>{"still"=>#<ActionDispatch::Http::UploadedFile:0x007f892ba849c0 @tempfile=#<Tempfile:/var/folders/k8/_r0t3frs1nq4y1t7qctc7z3h0000gn/T/RackMultipart20150121-77548-fbfkvt>,
 @original_filename="Pack and Go _ RobotStudio-ti_ShnUZkNs.mp4",
 @content_type="video/mp4",
 @headers="Content-Disposition: form-data; name=\"video[still]\"; filename=\"Pack and Go _ RobotStudio-ti_ShnUZkNs.mp4\"\r\nContent-Type: video/mp4\r\n">,
 "filename"=>"Pack and go to test qiniu",
 "description"=>"Pack and go to test qiniu,
 storage",
 "tag_list"=>"qiniu",
 "published"=>"1"},
 "commit"=>"upload",
 "locale"=>"zh-CN"}
undefined method `[]=' for nil:NilClass
def create          
    @video = Video.new(video_params)
    @video.user_id = current_user.id
    flash[:notice] = "Task was successfully created." if @video.save
    respond_with(@video)
end

还有这个

qiniu (6.4.1) lib/qiniu/upload.rb:54:in `upload_with_token_2'
qiniu (6.4.1) lib/qiniu/upload.rb:102:in `upload_with_put_policy'
/Users/bruceboty/.rvm/gems/ruby-2.1.5/bundler/gems/carrierwave-qiniu-c789e4db4705/lib/carrierwave/storage/qiniu.rb:37:in `store'
/Users/bruceboty/.rvm/gems/ruby-2.1.5/bundler/gems/carrierwave-qiniu-c789e4db4705/lib/carrierwave/storage/qiniu.rb:99:in `store'
/Users/bruceboty/.rvm/gems/ruby-2.1.5/bundler/gems/carrierwave-qiniu-c789e4db4705/lib/carrierwave/storage/qiniu.rb:159:in `store!'
carrierwave (0.10.0) lib/carrierwave/uploader/store.rb:59:in `block in store!'
carrierwave (0.10.0) lib/carrierwave/uploader/callbacks.rb:17:in `with_callbacks'
carrierwave (0.10.0) lib/carrierwave/uploader/store.rb:58:in `store!'
carrierwave (0.10.0) lib/carrierwave/mount.rb:375:in `store!'
carrierwave (0.10.0) lib/carrierwave/mount.rb:207:in `store_still!'
activesupport (4.1.8) lib/active_support/callbacks.rb:424:in `block in make_lambda'
activesupport (4.1.8) lib/active_support/callbacks.rb:221:in `call'
activesupport (4.1.8) lib/active_support/callbacks.rb:221:in `block in halting_and_conditional'
activesupport (4.1.8) lib/active_support/callbacks.rb:215:in `call'
activesupport (4.1.8) lib/active_support/callbacks.rb:215:in `block in halting_and_conditional'
activesupport (4.1.8) lib/active_support/callbacks.rb:86:in `call'
activesupport (4.1.8) lib/active_support/callbacks.rb:86:in `run_callbacks'
activerecord (4.1.8) lib/active_record/callbacks.rb:302:in `create_or_update'
activerecord (4.1.8) lib/active_record/persistence.rb:103:in `save'
activerecord (4.1.8) lib/active_record/validations.rb:51:in `save'
activerecord (4.1.8) lib/active_record/attribute_methods/dirty.rb:21:in `save'
activerecord (4.1.8) lib/active_record/transactions.rb:268:in `block (2 levels) in save'
activerecord (4.1.8) lib/active_record/transactions.rb:329:in `block in with_transaction_returning_status'
activerecord (4.1.8) lib/active_record/connection_adapters/abstract/database_statements.rb:201:in `block in transaction'
activerecord (4.1.8) lib/active_record/connection_adapters/abstract/database_statements.rb:209:in `within_new_transaction'
activerecord (4.1.8) lib/active_record/connection_adapters/abstract/database_statements.rb:201:in `transaction'
activerecord (4.1.8) lib/active_record/transactions.rb:208:in `transaction'
activerecord (4.1.8) lib/active_record/transactions.rb:326:in `with_transaction_returning_status'
activerecord (4.1.8) lib/active_record/transactions.rb:268:in `block in save'
activerecord (4.1.8) lib/active_record/transactions.rb:283:in `rollback_active_record_state!'
activerecord (4.1.8) lib/active_record/transactions.rb:267:in `save'
app/controllers/videos_controller.rb:89:in `create'
actionpack (4.1.8) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (4.1.8) lib/abstract_controller/base.rb:189:in `process_action'
actionpack (4.1.8) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (4.1.8) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
activesupport (4.1.8) lib/active_support/callbacks.rb:113:in `call'
activesupport (4.1.8) lib/active_support/callbacks.rb:113:in `call'
activesupport (4.1.8) lib/active_support/callbacks.rb:149:in `block in halting_and_conditional'
activesupport (4.1.8) lib/active_support/callbacks.rb:149:in `call'
activesupport (4.1.8) lib/active_support/callbacks.rb:149:in `block in halting_and_conditional'
activesupport (4.1.8) lib/active_support/callbacks.rb:166:in `call'
activesupport (4.1.8) lib/active_support/callbacks.rb:166:in `block in halting'
activesupport (4.1.8) lib/active_support/callbacks.rb:166:in `call'
activesupport (4.1.8) lib/active_support/callbacks.rb:166:in `block in halting'
activesupport (4.1.8) lib/active_support/callbacks.rb:149:in `call'
activesupport (4.1.8) lib/active_support/callbacks.rb:149:in `block in halting_and_conditional'
activesupport (4.1.8) lib/active_support/callbacks.rb:229:in `call'
activesupport (4.1.8) lib/active_support/callbacks.rb:229:in `block in halting'
activesupport (4.1.8) lib/active_support/callbacks.rb:166:in `call'
activesupport (4.1.8) lib/active_support/callbacks.rb:166:in `block in halting'
activesupport (4.1.8) lib/active_support/callbacks.rb:166:in `call'
activesupport (4.1.8) lib/active_support/callbacks.rb:166:in `block in halting'
activesupport (4.1.8) lib/active_support/callbacks.rb:86:in `call'
activesupport (4.1.8) lib/active_support/callbacks.rb:86:in `run_callbacks'
actionpack (4.1.8) lib/abstract_controller/callbacks.rb:19:in `process_action'
actionpack (4.1.8) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (4.1.8) lib/action_controller/metal/instrumentation.rb:31:in `block in process_action'
activesupport (4.1.8) lib/active_support/notifications.rb:159:in `block in instrument'
activesupport (4.1.8) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.1.8) lib/active_support/notifications.rb:159:in `instrument'
actionpack (4.1.8) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (4.1.8) lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
activerecord (4.1.8) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (4.1.8) lib/abstract_controller/base.rb:136:in `process'
actionview (4.1.8) lib/action_view/rendering.rb:30:in `process'
actionpack (4.1.8) lib/action_controller/metal.rb:196:in `dispatch'
actionpack (4.1.8) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
actionpack (4.1.8) lib/action_controller/metal.rb:232:in `block in action'
actionpack (4.1.8) lib/action_dispatch/routing/route_set.rb:82:in `call'
actionpack (4.1.8) lib/action_dispatch/routing/route_set.rb:82:in `dispatch'
actionpack (4.1.8) lib/action_dispatch/routing/route_set.rb:50:in `call'
actionpack (4.1.8) lib/action_dispatch/journey/router.rb:73:in `block in call'
actionpack (4.1.8) lib/action_dispatch/journey/router.rb:59:in `each'
actionpack (4.1.8) lib/action_dispatch/journey/router.rb:59:in `call'
actionpack (4.1.8) lib/action_dispatch/routing/route_set.rb:678:in `call'
warden (1.2.3) lib/warden/manager.rb:35:in `block in call'
warden (1.2.3) lib/warden/manager.rb:34:in `catch'
warden (1.2.3) lib/warden/manager.rb:34:in `call'
rack (1.5.2) lib/rack/etag.rb:23:in `call'
rack (1.5.2) lib/rack/conditionalget.rb:35:in `call'
rack (1.5.2) lib/rack/head.rb:11:in `call'
actionpack (4.1.8) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.1.8) lib/action_dispatch/middleware/flash.rb:254:in `call'
rack (1.5.2) lib/rack/session/abstract/id.rb:225:in `context'
rack (1.5.2) lib/rack/session/abstract/id.rb:220:in `call'
actionpack (4.1.8) lib/action_dispatch/middleware/cookies.rb:560:in `call'
activerecord (4.1.8) lib/active_record/query_cache.rb:36:in `call'
activerecord (4.1.8) lib/active_record/connection_adapters/abstract/connection_pool.rb:621:in `call'
activerecord (4.1.8) lib/active_record/migration.rb:380:in `call'
actionpack (4.1.8) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.1.8) lib/active_support/callbacks.rb:82:in `run_callbacks'
actionpack (4.1.8) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.1.8) lib/action_dispatch/middleware/reloader.rb:73:in `call'
actionpack (4.1.8) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
actionpack (4.1.8) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
actionpack (4.1.8) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.1.8) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.1.8) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.1.8) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.1.8) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.1.8) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.1.8) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.1.8) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
rack (1.5.2) lib/rack/runtime.rb:17:in `call'
activesupport (4.1.8) lib/active_support/cache/strategy/local_cache_middleware.rb:26:in `call'
rack (1.5.2) lib/rack/lock.rb:17:in `call'
actionpack (4.1.8) lib/action_dispatch/middleware/static.rb:84:in `call'
rack (1.5.2) lib/rack/sendfile.rb:112:in `call'
railties (4.1.8) lib/rails/engine.rb:514:in `call'
railties (4.1.8) lib/rails/application.rb:144:in `call'
rack (1.5.2) lib/rack/content_length.rb:14:in `call'
thin (1.6.3) lib/thin/connection.rb:86:in `block in pre_process'
thin (1.6.3) lib/thin/connection.rb:84:in `catch'
thin (1.6.3) lib/thin/connection.rb:84:in `pre_process'
thin (1.6.3) lib/thin/connection.rb:53:in `process'
thin (1.6.3) lib/thin/connection.rb:39:in `receive_data'
eventmachine (1.0.4) lib/eventmachine.rb:187:in `run_machine'
eventmachine (1.0.4) lib/eventmachine.rb:187:in `run'
thin (1.6.3) lib/thin/backends/base.rb:73:in `start'
thin (1.6.3) lib/thin/server.rb:162:in `start'
rack (1.5.2) lib/rack/handler/thin.rb:16:in `run'
rack (1.5.2) lib/rack/server.rb:264:in `start'
railties (4.1.8) lib/rails/commands/server.rb:69:in `start'
railties (4.1.8) lib/rails/commands/commands_tasks.rb:81:in `block in server'
railties (4.1.8) lib/rails/commands/commands_tasks.rb:76:in `tap'
railties (4.1.8) lib/rails/commands/commands_tasks.rb:76:in `server'
railties (4.1.8) lib/rails/commands/commands_tasks.rb:40:in `run_command!'
railties (4.1.8) lib/rails/commands.rb:17:in `<top (required)>'
bin/rails:8:in `require'
bin/rails:8:in `<main>'

@brucebot 你使用 当前分支就可以了 已经修正 41f765a

多谢!
这么大早提交,辛苦了。

发自我的 iPhone

在 2015年1月25日,上午7:48,Marble Wu notifications@github.com 写道:

@brucebot 你使用 当前分支就可以了 已经修正 41f765a


Reply to this email directly or view it on GitHub.