module SqlcachedClient::Attachments::ClassMethods
Attributes
attachment_name[R]
Public Class Methods
new(conditions, content)
click to toggle source
Calls superclass method
# File lib/sqlcached_client/attachments.rb, line 21 def initialize(conditions, content) super(self.class.attachment_name, conditions, content) end
Public Instance Methods
build_attachments(name, conditions, size)
click to toggle source
# File lib/sqlcached_client/attachments.rb, line 30 def build_attachments(name, conditions, size) size.times.map { @attachment_classes[name].new(conditions, nil) } end
has_attachment(name, &block)
click to toggle source
# File lib/sqlcached_client/attachments.rb, line 8 def has_attachment(name, &block) entity_class = self @attachment_classes ||= {} @attachment_classes[name] = Class.new(Attachment) do @attachment_name = name @entity_class = entity_class class << self attr_reader :attachment_name end def initialize(conditions, content) super(self.class.attachment_name, conditions, content) end instance_exec(&block) end attr_accessor(name) end