Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Clear the AR column from remove_#{column}!

  • Loading branch information...
commit 574e79c8c68317e85365c887094b09a0cc7a16b5 1 parent 4e07f9a
Jacob Tjoernholm chopmo authored
6 lib/carrierwave/orm/activerecord.rb
View
@@ -43,6 +43,12 @@ def remote_#{column}_url=(url)
super
end
+ def remove_#{column}!
+ super
+ _mounter(:#{column}).remove = true
+ _mounter(:#{column}).write_identifier
+ end
+
def serializable_hash(options=nil)
hash = {}
12 spec/orm/activerecord_spec.rb
View
@@ -318,6 +318,18 @@ def monkey
end
end
+ describe "remove_image!" do
+ before do
+ @event.image = stub_file('test.jpeg')
+ @event.save!
+ @event.remove_image!
+ end
+
+ it "should clear the serialization column" do
+ @event.attributes['image'].should be_blank
+ end
+ end
+
describe "dirty tracking with remote_image_url" do
# FIXME ideally image_changed? and remote_image_url_changed? would return true
Please sign in to comment.
Something went wrong with that request. Please try again.