Friday, 15 August 2014

ruby on rails - Replacing an Carrierwave Image -



ruby on rails - Replacing an Carrierwave Image -

using carrierwave (0.10.0), i'm trying replace existing image 1 of records setting image attribute new image. however, when this, new image not saved , image attribute set empty string.

post = post.last post.image? # => true post.image # => /uploads/post/1/a.png post.image = file.new(rails.root.join("app", "assets", "images", "b.png")) post.save # => true post.image? # => false post.image.inspect # => ""

i've tried calling remove_image! , remove_previously_stored_image beforehand, same result. overwriting image incorrectly or missing something?

ruby-on-rails ruby carrierwave

No comments:

Post a Comment