Method: Paperclip::Interpolations#class

Defined in:
lib/paperclip/interpolations.rb

#class(attachment = nil, style_name = nil) ⇒ Object

Returns the underscored, pluralized version of the class name. e.g. “users” for the User class. NOTE: The arguments need to be optional, because some tools fetch all class names. Calling #class will return the expected class.



79
80
81
82
# File 'lib/paperclip/interpolations.rb', line 79

def class attachment = nil, style_name = nil
  return super() if attachment.nil? && style_name.nil?
  attachment.instance.class.to_s.underscore.pluralize
end