无法使用社区引擎gem上传照片

时间:2014-03-06 22:48:39

标签: ruby-on-rails-3.2 paperclip ruby-1.9.3 photo-upload communityengine

我正在使用project使用Community engine gem(2.3.1)。我正在使用ruby 1.9.3和rails 3.2.8

当我尝试上传个人资料照片时,我收到以下错误 -

can't convert Configatron::Store to Array (Configatron::Store#to_ary gives Configatron::Store).

应用程序跟踪给出以下错误 -

configatron (3.0.1) lib/configatron/store.rb:81:in `method_missing'

作为我正在尝试的照片上传的一部分传递的参数在下面给出 -

{"utf8"=>"✓",
 "_method"=>"put",
 "authenticity_token"=>"mLZMbkUHoupgAZyJKFS4Zif0s3MTGZQowY4Rt4ugUJo=",
 "user"=>{"avatar_attributes"=>{"photo"=>#<ActionDispatch::Http::UploadedFile:0xafc4d38 @original_filename="img_0875.jpg",
 @content_type="image/jpeg",
 @headers="Content-Disposition: form-data; name=\"user[avatar_attributes][photo]\"; filename=\"img_0875.jpg\"\r\nContent-Type: image/jpeg\r\n",
 @tempfile=#<File:/tmp/RackMultipart20140307-19979-1r5bo7u>>,
 "user_id"=>3},
 "zip"=>"",
 "birthday(1i)"=>"1982",
 "birthday(2i)"=>"3",
 "birthday(3i)"=>"7",
 "description"=>""},
 "country_id"=>"",
 "tag_list"=>"",
 "commit"=>"Save Changes",
 "id"=>"chris"}

如果有帮助,下面会捕获完整的痕迹 -

configatron (3.0.1) lib/configatron/store.rb:81:in `method_missing'
paperclip (3.5.1) lib/paperclip/attachment.rb:188:in `styles'
paperclip (3.5.1) lib/paperclip/attachment.rb:423:in `post_process_styles'
paperclip (3.5.1) lib/paperclip/attachment.rb:416:in `block (2 levels) in post_process'
activesupport (3.2.8) lib/active_support/callbacks.rb:436:in `_run__210846493__photo_post_process__19440801__callbacks'
activesupport (3.2.8) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.8) lib/active_support/callbacks.rb:385:in `_run_photo_post_process_callbacks'
activesupport (3.2.8) lib/active_support/callbacks.rb:81:in `run_callbacks'
paperclip (3.5.1) lib/paperclip/callbacks.rb:26:in `run_paperclip_callbacks'
paperclip (3.5.1) lib/paperclip/attachment.rb:414:in `block in post_process'
activesupport (3.2.8) lib/active_support/callbacks.rb:403:in `_run__210846493__post_process__19440801__callbacks'
activesupport (3.2.8) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.8) lib/active_support/callbacks.rb:385:in `_run_post_process_callbacks'
activesupport (3.2.8) lib/active_support/callbacks.rb:81:in `run_callbacks'
paperclip (3.5.1) lib/paperclip/callbacks.rb:26:in `run_paperclip_callbacks'
paperclip (3.5.1) lib/paperclip/attachment.rb:413:in `post_process'
paperclip (3.5.1) lib/paperclip/attachment.rb:112:in `assign'
paperclip (3.5.1) lib/paperclip/has_attached_file.rb:65:in `block in define_setter'
activerecord (3.2.8) lib/active_record/attribute_assignment.rb:85:in `block in assign_attributes'
activerecord (3.2.8) lib/active_record/attribute_assignment.rb:78:in `each'
activerecord (3.2.8) lib/active_record/attribute_assignment.rb:78:in `assign_attributes'
activerecord (3.2.8) lib/active_record/base.rb:498:in `initialize'
activerecord (3.2.8) lib/active_record/reflection.rb:183:in `new'
activerecord (3.2.8) lib/active_record/reflection.rb:183:in `build_association'
activerecord (3.2.8) lib/active_record/associations/association.rb:233:in `build_record'
activerecord (3.2.8) lib/active_record/associations/singular_association.rb:29:in `build'
activerecord (3.2.8) lib/active_record/associations/builder/singular_association.rb:20:in `block in define_constructors'
activerecord (3.2.8) lib/active_record/nested_attributes.rb:337:in `assign_nested_attributes_for_one_to_one_association'
activerecord (3.2.8) lib/active_record/nested_attributes.rb:288:in `avatar_attributes='
activerecord (3.2.8) lib/active_record/attribute_assignment.rb:94:in `block in assign_attributes'
activerecord (3.2.8) lib/active_record/attribute_assignment.rb:93:in `each'
activerecord (3.2.8) lib/active_record/attribute_assignment.rb:93:in `assign_attributes'
activerecord (3.2.8) lib/active_record/persistence.rb:215:in `block in update_attributes'
activerecord (3.2.8) lib/active_record/transactions.rb:295:in `block in with_transaction_returning_status'
activerecord (3.2.8) lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
activerecord (3.2.8) lib/active_record/transactions.rb:208:in `transaction'
activerecord (3.2.8) lib/active_record/transactions.rb:293:in `with_transaction_returning_status'
activerecord (3.2.8) lib/active_record/persistence.rb:214:in `update_attributes'
community_engine (2.3.1) app/controllers/users_controller.rb:124:in `update'
actionpack (3.2.8) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (3.2.8) lib/abstract_controller/base.rb:167:in `process_action'
actionpack (3.2.8) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (3.2.8) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (3.2.8) lib/active_support/callbacks.rb:504:in `block (2 levels) in _run__201379291__process_action__881180949__callbacks'
activesupport (3.2.8) lib/active_support/callbacks.rb:215:in `block in _conditional_callback_around_1633'
activesupport (3.2.8) lib/active_support/callbacks.rb:326:in `around'
activesupport (3.2.8) lib/active_support/callbacks.rb:310:in `_callback_around_1600'
activesupport (3.2.8) lib/active_support/callbacks.rb:214:in `_conditional_callback_around_1633'
activesupport (3.2.8) lib/active_support/callbacks.rb:459:in `block in _run__201379291__process_action__881180949__callbacks'
activesupport (3.2.8) lib/active_support/callbacks.rb:215:in `block in _conditional_callback_around_1632'
community_engine (2.3.1) lib/community_engine/localized_application.rb:30:in `set_locale'
activesupport (3.2.8) lib/active_support/callbacks.rb:214:in `_conditional_callback_around_1632'
activesupport (3.2.8) lib/active_support/callbacks.rb:425:in `_run__201379291__process_action__881180949__callbacks'
activesupport (3.2.8) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.8) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
activesupport (3.2.8) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.8) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.2.8) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (3.2.8) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.2.8) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.8) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.8) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.8) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.2.8) lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
activerecord (3.2.8) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (3.2.8) lib/abstract_controller/base.rb:121:in `process'
actionpack (3.2.8) lib/abstract_controller/rendering.rb:45:in `process'
actionpack (3.2.8) lib/action_controller/metal.rb:203:in `dispatch'
actionpack (3.2.8) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.2.8) lib/action_controller/metal.rb:246:in `block in action'
actionpack (3.2.8) lib/action_dispatch/routing/route_set.rb:73:in `call'
actionpack (3.2.8) lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
actionpack (3.2.8) lib/action_dispatch/routing/route_set.rb:36:in `call'
journey (1.0.4) lib/journey/router.rb:68:in `block in call'
journey (1.0.4) lib/journey/router.rb:56:in `each'
journey (1.0.4) lib/journey/router.rb:56:in `call'
actionpack (3.2.8) lib/action_dispatch/routing/route_set.rb:600:in `call'
request_store (1.0.5) lib/request_store/middleware.rb:9:in `call'
rakismet (1.5.0) lib/rakismet/middleware.rb:10:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
rack (1.4.5) lib/rack/etag.rb:23:in `call'
rack (1.4.5) lib/rack/conditionalget.rb:35:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/head.rb:14:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/flash.rb:242:in `call'
rack (1.4.5) lib/rack/session/abstract/id.rb:210:in `context'
rack (1.4.5) lib/rack/session/abstract/id.rb:205:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/cookies.rb:339:in `call'
activerecord (3.2.8) lib/active_record/query_cache.rb:64:in `call'
activerecord (3.2.8) lib/active_record/connection_adapters/abstract/connection_pool.rb:473:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (3.2.8) lib/active_support/callbacks.rb:405:in `_run__67611987__call__19440801__callbacks'
activesupport (3.2.8) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.8) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
activesupport (3.2.8) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.8) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/reloader.rb:65:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.8) lib/rails/rack/logger.rb:26:in `call_app'
railties (3.2.8) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.5) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.5) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.8) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.5) lib/rack/lock.rb:15:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/static.rb:62:in `call'
railties (3.2.8) lib/rails/engine.rb:479:in `call'
railties (3.2.8) lib/rails/application.rb:223:in `call'
rack (1.4.5) lib/rack/content_length.rb:14:in `call'
railties (3.2.8) lib/rails/rack/log_tailer.rb:17:in `call'
rack (1.4.5) lib/rack/handler/webrick.rb:59:in `service'
/home/mohnish/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
/home/mohnish/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
/home/mohnish/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'

我不确定到底出了什么问题。如果我能够了解我需要做些什么才能使照片上传功能正常工作,那就太棒了。

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题。在community_engine.gemspec中更新configatron和paperclip的版本为我解决了这个问题。

尝试将configatron设置为~>2.0,将回形针设置为~> 4.1.1