Module: ScribdFu::ActsAsScribdDocument

Defined in:
lib/scribd_fu.rb

Instance Method Summary collapse

Instance Method Details

#acts_as_scribd_documentObject

Synonym for has_scribdable_attachment(nil).



34
35
36
# File 'lib/scribd_fu.rb', line 34

def acts_as_scribd_document
  has_scribdable_attachment
end

#has_scribdable_attachment(attribute = nil) ⇒ Object

Marks the given attribute as a scribdable document file. If attribute is nil, assumes this is an Attachment_fu model and deals with the setup accordingly; otherwise, assumes a paperclip model and sets up scribding related to the particular given attribute.



42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/scribd_fu.rb', line 42

def has_scribdable_attachment(attribute = nil)
  class_eval do
    include ScribdFu::InstanceMethods

    if attribute.nil?
      include ScribdFu::AttachmentFu::InstanceMethods
    else
      include ScribdFu::Paperclip::InstanceMethods # ignored if already done

      add_scribd_attribute attribute # class method added by above include
    end
  end
end