Module: Clot::ActiveRecord::Droppable

Defined in:
lib/clot/active_record/droppable.rb

Instance Method Summary collapse

Instance Method Details

#collection_labelObject



20
21
22
23
24
25
# File 'lib/clot/active_record/droppable.rb', line 20

def collection_label
  if respond_to? :label then return label end
  if respond_to? :title then return title end
  if respond_to? :name then return name end
  "label for item number :#{id}"
end

#get_drop_class(class_obj) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/clot/active_record/droppable.rb', line 5

def get_drop_class(class_obj)
  begin
    drop_string = class_obj.to_s + "Drop"
    drop_class = drop_string.constantize
    drop_class
  rescue
    get_drop_class class_obj.superclass
  end
end

#to_liquidObject



15
16
17
18
# File 'lib/clot/active_record/droppable.rb', line 15

def to_liquid
  drop_class = get_drop_class self.class
  drop_class.new self
end