新手问题 gem 'carrierwave'创建一个 ImageUpload 可以重复用在不同的 model 里面吗?

1272729223 · 2012年08月05日 · 最后由 1272729223 回复于 2012年08月05日 · 3324 次阅读

现在一个 article 有这个功能,另外一个 product 也有这个功能,我同时:

rails g migration add_image_to_products image:string
rails g migration add_image_to_articles image:string

现在 products 和 articles 表中都有这个 t.string“image”的字段了, 但是我给 product 添加图片,点击 submit 之后,服务器就退出来了。

我一开始先弄 articles 的,可以正常发布图片

现在重新编辑之前发布的 articles 的图片,也导致服务器退出这个问题

可以。没日志不清楚。

[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

[1]    35754 abort      rails s
=> Booting WEBrick
=> Rails 3.2.6 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2012-08-05 19:01:35] INFO  WEBrick 1.3.1
[2012-08-05 19:01:35] INFO  ruby 1.9.3 (2012-04-20) [x86_64-darwin11.4.0]
[2012-08-05 19:01:35] INFO  WEBrick::HTTPServer#start: pid=35806 port=3000
/Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/carrierwave-0.6.2/lib/carrierwave/processing/rmagick.rb:248: [BUG] Segmentation fault
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.4.0]

-- Control frame information -----------------------------------------------
c:0105 p:---- s:0545 b:0545 l:000544 d:000544 CFUNC  :read
c:0104 p:0054 s:0541 b:0541 l:000540 d:000540 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/carrierwave-0.6.2/lib/carrierwave/processing/rmagick.rb:248
c:0103 p:0011 s:0531 b:0531 l:0019c8 d:0019c8 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/carrierwave-0.6.2/lib/carrierwave/processing/rmagick.rb:161
c:0102 p:0092 s:0526 b:0526 l:000515 d:000525 BLOCK  /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/carrierwave-0.6.2/lib/carrierwave/uploader/processing.rb:85
c:0101 p:---- s:0521 b:0521 l:000520 d:000520 FINISH
c:0100 p:---- s:0519 b:0519 l:000518 d:000518 CFUNC  :each
c:0099 p:0037 s:0516 b:0516 l:000515 d:000515 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/carrierwave-0.6.2/lib/carrierwave/uploader/processing.rb:81
c:0098 p:0015 s:0512 b:0512 l:000503 d:000511 BLOCK  /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/carrierwave-0.6.2/lib/carrierwave/uploader/callbacks.rb:18
c:0097 p:---- s:0509 b:0509 l:000508 d:000508 FINISH
c:0096 p:---- s:0507 b:0507 l:000506 d:000506 CFUNC  :each
c:0095 p:0059 s:0504 b:0504 l:000503 d:000503 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/carrierwave-0.6.2/lib/carrierwave/uploader/callbacks.rb:18
c:0094 p:0091 s:0499 b:0499 l:000498 d:000498 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/carrierwave-0.6.2/lib/carrierwave/uploader/cache.rb:112
c:0093 p:0019 s:0495 b:0495 l:000494 d:000494 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/carrierwave-0.6.2/lib/carrierwave/mount.rb:315
c:0092 p:0021 s:0490 b:0490 l:000489 d:000489 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/carrierwave-0.6.2/lib/carrierwave/mount.rb:173
c:0091 p:0054 s:0486 b:0486 l:000485 d:000485 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/carrierwave-0.6.2/lib/carrierwave/orm/activerecord.rb:37
c:0090 p:0106 s:0481 b:0481 l:000471 d:000480 BLOCK  /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.6/lib/active_record/attribute_assignment.rb:85
c:0089 p:---- s:0477 b:0477 l:000476 d:000476 FINISH
c:0088 p:---- s:0475 b:0475 l:000474 d:000474 CFUNC  :each
c:0087 p:0089 s:0472 b:0472 l:000471 d:000471 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.6/lib/active_record/attribute_assignment.rb:78
c:0086 p:0015 s:0464 b:0464 l:0025f8 d:000463 BLOCK  /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.6/lib/active_record/persistence.rb:212
c:0085 p:0015 s:0462 b:0462 l:0026b0 d:000461 BLOCK  /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.6/lib/active_record/transactions.rb:295
c:0084 p:0232 s:0460 b:0460 l:000459 d:000459 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/database_statemen
c:0083 p:0025 s:0451 b:0451 l:000450 d:000450 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.6/lib/active_record/transactions.rb:208
c:0082 p:0022 s:0446 b:0446 l:0026b0 d:0026b0 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.6/lib/active_record/transactions.rb:293
c:0081 p:0015 s:0442 b:0442 l:0025f8 d:0025f8 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.6/lib/active_record/persistence.rb:211
c:0080 p:0022 s:0437 b:0437 l:002058 d:000436 BLOCK  /Users/yuwen/Documents/bitbucket/daci/app/controllers/articles_controller.rb:64
c:0079 p:---- s:0434 b:0434 l:000433 d:000433 FINISH
c:0078 p:---- s:0432 b:0432 l:000431 d:000431 CFUNC  :call
c:0077 p:0068 s:0428 b:0428 l:000427 d:000427 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.6/lib/action_controller/metal/mime_responds.rb:270
c:0076 p:0053 s:0421 b:0421 l:000420 d:000420 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.6/lib/action_controller/metal/mime_responds.rb:194
c:0075 p:0040 s:0414 b:0414 l:002058 d:002058 METHOD /Users/yuwen/Documents/bitbucket/daci/app/controllers/articles_controller.rb:63
c:0074 p:0014 s:0411 b:0411 l:000410 d:000410 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.6/lib/action_controller/metal/implicit_render.rb:4
c:0073 p:0015 s:0405 b:0405 l:000404 d:000404 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.6/lib/abstract_controller/base.rb:167
c:0072 p:0041 s:0400 b:0400 l:000399 d:000399 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.6/lib/action_controller/metal/rendering.rb:10
c:0071 p:0010 s:0396 b:0396 l:001f60 d:000395 BLOCK  /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.6/lib/abstract_controller/callbacks.rb:18
c:0070 p:0140 s:0394 b:0394 l:000393 d:000393 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:425
c:0069 p:0115 s:0388 b:0388 l:000387 d:000387 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:405
c:0068 p:0027 s:0379 b:0379 l:000378 d:000378 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:385
c:0067 p:0024 s:0374 b:0374 l:000373 d:000373 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:81
c:0066 p:0020 s:0368 b:0368 l:001f60 d:001f60 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.6/lib/abstract_controller/callbacks.rb:17
c:0065 p:0012 s:0364 b:0364 l:000363 d:000363 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.6/lib/action_controller/metal/rescue.rb:29
c:0064 p:0010 s:0359 b:0359 l:000340 d:000358 BLOCK  /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.6/lib/action_controller/metal/instrumentation.rb:30
c:0063 p:0017 s:0355 b:0355 l:000345 d:000354 BLOCK  /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.6/lib/active_support/notifications.rb:123
c:0062 p:0032 s:0353 b:0353 l:000352 d:000352 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.6/lib/active_support/notifications/instrumenter.rb:20
c:0061 p:0036 s:0346 b:0346 l:000345 d:000345 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.6/lib/active_support/notifications.rb:123
c:0060 p:0152 s:0341 b:0341 l:000340 d:000340 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.6/lib/action_controller/metal/instrumentation.rb:29
c:0059 p:0143 s:0336 b:0336 l:000335 d:000335 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.6/lib/action_controller/metal/params_wrapper.rb:206
c:0058 p:0032 s:0330 b:0330 l:000329 d:000329 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.6/lib/active_record/railties/controller_runtime.rb:18
c:0057 p:0093 s:0325 b:0325 l:000324 d:000324 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.6/lib/abstract_controller/base.rb:121
c:0056 p:0084 s:0319 b:0319 l:000318 d:000318 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.6/lib/abstract_controller/rendering.rb:45
c:0055 p:0048 s:0314 b:0314 l:000313 d:000313 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.6/lib/action_controller/metal.rb:203
c:0054 p:0086 s:0309 b:0309 l:000308 d:000308 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.6/lib/action_controller/metal/rack_delegation.rb:14
c:0053 p:0030 s:0303 b:0303 l:001808 d:000302 BLOCK  /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.6/lib/action_controller/metal.rb:246
c:0052 p:---- s:0300 b:0300 l:000299 d:000299 FINISH
c:0051 p:---- s:0298 b:0298 l:000297 d:000297 CFUNC  :call
c:0050 p:0022 s:0294 b:0294 l:000293 d:000293 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.6/lib/action_dispatch/routing/route_set.rb:73
c:0049 p:0094 s:0288 b:0288 l:000287 d:000287 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.6/lib/action_dispatch/routing/route_set.rb:36
c:0048 p:0184 s:0282 b:0282 l:000265 d:000281 BLOCK  /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/journey-1.0.4/lib/journey/router.rb:68
c:0047 p:---- s:0271 b:0271 l:000270 d:000270 FINISH
c:0046 p:---- s:0269 b:0269 l:000268 d:000268 CFUNC  :each
c:0045 p:0051 s:0266 b:0266 l:000265 d:000265 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/journey-1.0.4/lib/journey/router.rb:56
c:0044 p:0025 s:0262 b:0262 l:000261 d:000261 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.6/lib/action_dispatch/routing/route_set.rb:600
c:0043 p:0014 s:0258 b:0258 l:000249 d:000257 BLOCK  /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/warden-1.2.1/lib/warden/manager.rb:35
c:0042 p:---- s:0256 b:0256 l:000255 d:000255 FINISH
c:0041 p:---- s:0254 b:0254 l:000253 d:000253 CFUNC  :catch
c:0040 p:0086 s:0250 b:0250 l:000249 d:000249 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/warden-1.2.1/lib/warden/manager.rb:34
c:0039 p:0015 s:0245 b:0245 l:000244 d:000244 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.6/lib/action_dispatch/middleware/best_standards_support.rb:17
c:0038 p:0015 s:0238 b:0238 l:000237 d:000237 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/etag.rb:23
c:0037 p:0052 s:0230 b:0230 l:000229 d:000229 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/conditionalget.rb:35
c:0036 p:0093 s:0223 b:0223 l:000222 d:000222 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.6/lib/action_dispatch/middleware/head.rb:14
c:0035 p:0046 s:0216 b:0216 l:000215 d:000215 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.6/lib/action_dispatch/middleware/params_parser.rb:21
c:0034 p:0054 s:0211 b:0211 l:000210 d:000210 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.6/lib/action_dispatch/middleware/flash.rb:242
c:0033 p:0031 s:0203 b:0203 l:000202 d:000202 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/session/abstract/id.rb:205
c:0032 p:0013 s:0195 b:0195 l:000194 d:000194 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/session/abstract/id.rb:200
c:0031 p:0020 s:0191 b:0191 l:000190 d:000190 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.6/lib/action_dispatch/middleware/cookies.rb:338
c:0030 p:0064 s:0183 b:0183 l:000182 d:000182 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.6/lib/active_record/query_cache.rb:64
c:0029 p:0029 s:0174 b:0174 l:000173 d:000173 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.r
c:0028 p:0014 s:0166 b:0166 l:001170 d:000165 BLOCK  /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.6/lib/action_dispatch/middleware/callbacks.rb:28
c:0027 p:0040 s:0164 b:0164 l:000163 d:000163 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:405
c:0026 p:0115 s:0157 b:0157 l:000156 d:000156 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:405
c:0025 p:0027 s:0148 b:0148 l:000147 d:000147 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:385
c:0024 p:0024 s:0143 b:0143 l:000142 d:000142 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:81
c:0023 p:0013 s:0137 b:0137 l:001170 d:001170 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.6/lib/action_dispatch/middleware/callbacks.rb:27
c:0022 p:0039 s:0133 b:0133 l:000132 d:000132 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.6/lib/action_dispatch/middleware/reloader.rb:65
c:0021 p:0044 s:0128 b:0128 l:000127 d:000127 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.6/lib/action_dispatch/middleware/remote_ip.rb:31
c:0020 p:0017 s:0124 b:0124 l:000123 d:000123 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.6/lib/action_dispatch/middleware/debug_exceptions.rb:16
c:0019 p:0017 s:0117 b:0117 l:000116 d:000116 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.6/lib/action_dispatch/middleware/show_exceptions.rb:56
c:0018 p:0121 s:0111 b:0111 l:000110 d:000110 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.6/lib/rails/rack/logger.rb:26
c:0017 p:0052 s:0105 b:0105 l:000104 d:000104 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.6/lib/rails/rack/logger.rb:16
c:0016 p:0048 s:0101 b:0101 l:000100 d:000100 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.6/lib/action_dispatch/middleware/request_id.rb:22
c:0015 p:0095 s:0094 b:0094 l:000093 d:000093 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/methodoverride.rb:21
c:0014 p:0032 s:0089 b:0089 l:000088 d:000088 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/runtime.rb:17
c:0013 p:0057 s:0080 b:0080 l:000079 d:000079 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.6/lib/active_support/cache/strategy/local_cache.rb:72
c:0012 p:0068 s:0076 b:0076 l:000075 d:000075 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/lock.rb:15
c:0011 p:0124 s:0070 b:0070 l:000069 d:000069 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.6/lib/action_dispatch/middleware/static.rb:62
c:0010 p:0032 s:0064 b:0064 l:000063 d:000063 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.6/lib/rails/engine.rb:479
c:0009 p:0034 s:0060 b:0060 l:000059 d:000059 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.6/lib/rails/application.rb:220
c:0008 p:0015 s:0056 b:0056 l:000055 d:000055 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/content_length.rb:14
c:0007 p:0015 s:0047 b:0047 l:000046 d:000046 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.6/lib/rails/rack/log_tailer.rb:17
c:0006 p:0356 s:0042 b:0042 l:000041 d:000041 METHOD /Users/yuwen/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/handler/webrick.rb:59
c:0005 p:0257 s:0030 b:0030 l:000029 d:000029 METHOD /Users/yuwen/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/httpserver.rb:138
c:0004 p:0393 s:0020 b:0020 l:000019 d:000019 METHOD /Users/yuwen/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/httpserver.rb:94
c:0003 p:0126 s:0009 b:0009 l:0008d8 d:000008 BLOCK  /Users/yuwen/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/server.rb:191
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:---- s:0002 b:0002 l:000001 d:000001 TOP   

-- Ruby level backtrace information ----------------------------------------

下面还有好几屏幕

我搜到几个了,先试试,估计有帮助的。

需要 登录 后方可回复, 如果你还没有账号请 注册新账号