Module: Paperclip::Resource

Defined in:
lib/dm-paperclip.rb

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
# File 'lib/dm-paperclip.rb', line 210

def self.included(base)

  base.class_eval <<-RUBY, __FILE__, __LINE__ + 1
    class_variable_set(:@@attachment_definitions,nil) unless class_variable_defined?(:@@attachment_definitions)
    def self.attachment_definitions
      @@attachment_definitions
    end

    def self.attachment_definitions=(obj)
      @@attachment_definitions = obj
    end
  RUBY

  base.extend Paperclip::ClassMethods

  # Done at this time to ensure that the user
  # had a chance to configure the app in an initializer
  if Paperclip.config.use_dm_validations
    require 'dm-validations'
    require 'dm-paperclip/validations'
    base.extend Paperclip::Validate::ClassMethods
  end

  Paperclip.require_processors

end