Permalink
Browse files

github comments

  • Loading branch information...
1 parent 3e1501e commit 93377e6040d52f292cf2ef559a0d213959597a9f @xithan xithan committed Aug 30, 2016
Showing with 8 additions and 11 deletions.
  1. +1 −1 .gitignore
  2. +7 −10 card/mod/carrierwave/lib/carrier_wave/cardmount.rb
View
@@ -17,4 +17,4 @@ decko*gem
*.swp
test_work/*
*.orig
-card/spec/config/bucket_credentials.yml
+**/bucket_credentials.yml
@@ -63,24 +63,21 @@ def write_uploader *args
def #{column}=(new_file)
return if new_file.blank?
- db_column = _mounter(:#{column}).serialization_column
- send(:"\#{db_column}_will_change!")
- if web?
- self.content = new_file
- else
- send(:"#{column}_will_change!")
- super
- end
+ assign_attachment(new_file) { super }
end
def remote_#{column}_url=(url)
+ assign_attachment(url) { super }
+ end
+
+ def assign_attachment file
db_column = _mounter(:#{column}).serialization_column
send(:"\#{db_column}_will_change!")
if web?
- self.content = url
+ self.content = file
else
send(:"#{column}_will_change!")
- super
+ yield
end
end

0 comments on commit 93377e6

Please sign in to comment.