Module: CarrierWave::ActiveRecord

Includes:
Mount
Defined in:
lib/carrierwave/orm/activerecord.rb

Instance Method Summary collapse

Methods included from Mount

#uploader_option, #uploader_options, #uploaders

Instance Method Details

#mount_uploader(column, uploader = nil, options = {}, &block) ⇒ Object

See CarrierWave::Mount#mount_uploader for documentation



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/carrierwave/orm/activerecord.rb', line 12

def mount_uploader(column, uploader=nil, options={}, &block)
  super

  class_eval "def remote_\#{column}_url=(url)\ncolumn = _mounter(:\#{column}).serialization_column\nsend(:\"\\\#{column}_will_change!\")\nsuper\nend\n", __FILE__, __LINE__+1
end

#mount_uploaders(column, uploader = nil, options = {}, &block) ⇒ Object

See CarrierWave::Mount#mount_uploaders for documentation



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/carrierwave/orm/activerecord.rb', line 27

def mount_uploaders(column, uploader=nil, options={}, &block)
  super

  class_eval "def remote_\#{column}_urls=(url)\ncolumn = _mounter(:\#{column}).serialization_column\nsend(:\"\\\#{column}_will_change!\")\nsuper\nend\n", __FILE__, __LINE__+1
end