Module: CouchPotato::Attachments

Defined in:
lib/couch_potato/persistence/attachments.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object

:nodoc:



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/couch_potato/persistence/attachments.rb', line 3

def self.included(base) #:nodoc:
  base.class_eval do
    attr_writer :_attachments
    
    def _attachments
      @_attachments ||= {}
    end
    
    base.extend ClassMethods
  end
end

Instance Method Details

#to_hashObject



15
16
17
18
19
20
21
# File 'lib/couch_potato/persistence/attachments.rb', line 15

def to_hash
  if _attachments
    super.merge('_attachments' => _attachments)
  else
    super
  end
end