Class: Skyline::Editors::CheckableList

Inherits:
Editor
  • Object
show all
Defined in:
app/helpers/skyline/editors/checkable_list.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(names, record, field, template) ⇒ CheckableList

Returns a new instance of CheckableList.



4
5
6
7
8
9
10
11
12
13
# File 'app/helpers/skyline/editors/checkable_list.rb', line 4

def initialize(names,record,field,template)
  super
  
  reflection = self.field.reflection
  if reflection.macro == :has_and_belongs_to_many
    @target_class = reflection.klass
  else
    raise "CheckableList can only be used with HABTM associations (was: #{@reflection.macro})"
  end
end

Instance Attribute Details

#target_classObject (readonly)

Returns the value of attribute target_class.



2
3
4
# File 'app/helpers/skyline/editors/checkable_list.rb', line 2

def target_class
  @target_class
end

Instance Method Details

#output_without_errorsObject



15
16
17
18
19
# File 'app/helpers/skyline/editors/checkable_list.rb', line 15

def output_without_errors
  ("div",
    ("ul",self.render_records),
  :class => "checkable-list")
end