Class: AdminAssistant::PolymorphicBelongsToColumn::IndexView

Inherits:
Column::View
  • Object
show all
Includes:
Column::IndexViewMethods
Defined in:
lib/admin_assistant/polymorphic_belongs_to_column.rb

Instance Attribute Summary

Attributes inherited from Column::View

#sort_order

Instance Method Summary collapse

Methods included from Column::IndexViewMethods

#header_css_class, #html, #next_sort_params, #set_instance_variables_from_options, #td_css_classes, #unconfigured_html

Methods inherited from Column::View

#check_box_and_hidden_tags, #controller, #custom_template_file_path, #file_option_for_custom_template_render, #initialize, #label, #name, #paperclip?, #sort_possible?, #string

Constructor Details

This class inherits a constructor from AdminAssistant::Column::View

Instance Method Details

#value(record) ⇒ Object



75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/admin_assistant/polymorphic_belongs_to_column.rb', line 75

def value(record)
  v = record.send name
  if v
    target = AssociationTarget.new v.class
    str = target.name.capitalize
    fv = target.assoc_value v
    if fv
      str << " '#{fv}'"
    else
      str << " #{v.id}"
    end
  end
end