【发布时间】:2015-09-22 15:04:09
【问题描述】:
我使用蜻蜓来处理我的 rails 应用程序中的图像附件。
我在模型中使用了神奇的列 image_width 和 image_height。
这很好用。现在我在模型中得到了一些带有image_uid 的图像,图像是可访问的,但是image_width 和image_height 没有设置。 (它发生在 simple_dragonfly_preview 插件上)
现在我该如何强制重新计算值?所以在模型中是这样的:
before_save :update_image_fields
def update_image_fields
logger.info "Image size update"
if image_uid.present?
self.image_width = image.width # what to call here?
self.image_height = image.height
end
end
【问题讨论】:
标签: ruby-on-rails ruby dragonfly-gem