Module: ScribdFu::Paperclip::ClassMethods
- Defined in:
- lib/paperclip/methods.rb
Instance Method Summary collapse
- 
  
    
      #add_scribd_attribute(attribute)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Adds the given attributeto the list of attributes that are uploaded to scribd.
- #scribd_attributes ⇒ Object
- 
  
    
      #validates_attachment_scribdability(attribute = nil)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Adds validations to the current model to check that the attachment at attributeis scribdable.
Instance Method Details
#add_scribd_attribute(attribute) ⇒ Object
Adds the given attribute to the list of attributes that are uploaded to scribd.
Note that a scribd attribute should not be added if it is not a Paperclip attachment attribute.
| 30 31 32 33 34 35 36 | # File 'lib/paperclip/methods.rb', line 30 def add_scribd_attribute(attribute) write_inheritable_attribute :scribd_attributes, [] if scribd_attributes.nil? scribd_attributes << attribute setup_scribd_attribute(attribute) end | 
#scribd_attributes ⇒ Object
| 38 39 40 | # File 'lib/paperclip/methods.rb', line 38 def scribd_attributes read_inheritable_attribute :scribd_attributes end | 
#validates_attachment_scribdability(attribute = nil) ⇒ Object
Adds validations to the current model to check that the attachment at attribute is scribdable. If attribute is nil, then all attachments that have been marked as scribdable are validated.
Note that all calls to has_scribdable_attachment should be made before calling validates_attachment_scribdability with a nil parameter; otherwise, only those that have been created already will be validated.
| 13 14 15 16 17 18 19 20 21 22 23 | # File 'lib/paperclip/methods.rb', line 13 def (attribute = nil) attributes = attribute.nil? ? scribd_attributes : [attribute] attributes.each do |attribute| validates_presence_of "#{attribute}_scribd_id", "#{attribute}_scribd_access_key", "#{attribute}_content_type" attribute, :content_type => ScribdFu::CONTENT_TYPES end end |