carrierwave 0.5.4 → 0.5.5

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of carrierwave might be problematic. Click here for more details.

@@ -1,37 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require 'dm-core'
4
-
5
- module CarrierWave
6
- module DataMapper
7
-
8
- include CarrierWave::Mount
9
-
10
- ##
11
- # See +CarrierWave::Mount#mount_uploader+ for documentation
12
- #
13
- def mount_uploader(column, uploader, options={}, &block)
14
- super
15
-
16
- alias_method :read_uploader, :attribute_get
17
- alias_method :write_uploader, :attribute_set
18
- after :save, "store_#{column}!".to_sym
19
- pre_hook = ::DataMapper.const_defined?(:Validate) ? :valid? : :save
20
- before pre_hook, "write_#{column}_identifier".to_sym
21
- after :destroy, "remove_#{column}!".to_sym
22
-
23
- # FIXME: Hack to work around Datamapper not triggering callbacks
24
- # for objects that are not dirty. By explicitly calling
25
- # attribute_set we are marking the record as dirty.
26
- class_eval <<-RUBY
27
- def remove_#{column}=(value)
28
- _mounter(:#{column}).remove = value
29
- attribute_set(:#{column}, '') if _mounter(:#{column}).remove?
30
- end
31
- RUBY
32
- end
33
-
34
- end # DataMapper
35
- end # CarrierWave
36
-
37
- DataMapper::Model.send(:include, CarrierWave::DataMapper)
@@ -1,45 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require 'sequel'
4
-
5
- module CarrierWave
6
- module Sequel
7
- include CarrierWave::Mount
8
-
9
- def mount_uploader(column, uploader)
10
- raise "You need to use Sequel 3.0 or higher. Please upgrade." unless ::Sequel::Model.respond_to?(:plugin)
11
- super
12
-
13
- alias_method :read_uploader, :[]
14
- alias_method :write_uploader, :[]=
15
-
16
- include CarrierWave::Sequel::Hooks
17
- include CarrierWave::Sequel::Validations
18
- end
19
-
20
- end # Sequel
21
- end # CarrierWave
22
-
23
- # Instance hook methods for the Sequel 3.x
24
- module CarrierWave::Sequel::Hooks
25
- def after_save
26
- return false if super == false
27
- self.class.uploaders.each_key {|column| self.send("store_#{column}!") }
28
- end
29
-
30
- def before_save
31
- return false if super == false
32
- self.class.uploaders.each_key {|column| self.send("write_#{column}_identifier") }
33
- end
34
-
35
- def before_destroy
36
- return false if super == false
37
- self.class.uploaders.each_key {|column| self.send("remove_#{column}!") }
38
- end
39
- end
40
-
41
- # Instance validation methods for the Sequel 3.x
42
- module CarrierWave::Sequel::Validations
43
- end
44
-
45
- Sequel::Model.send(:extend, CarrierWave::Sequel)