Method: Paperclip::Attachment#instance_read
- Defined in:
- lib/paperclip/attachment.rb
#instance_read(attr) ⇒ Object
Reads the attachment-specific attribute on the instance. See instance_write for more details.
257 258 259 260 261 262 263 |
# File 'lib/paperclip/attachment.rb', line 257 def instance_read(attr) getter = :"#{name}_#{attr}" responds = instance.respond_to?(getter) cached = self.instance_variable_get("@_#{getter}") return cached if cached instance.send(getter) if responds || attr.to_s == "file_name" end |