Class: AdminAssistant::BelongsToColumn::View

Inherits:
Column::View show all
Defined in:
lib/admin_assistant/belongs_to_column.rb

Direct Known Subclasses

FormView, IndexView, SearchView, ShowView

Instance Attribute Summary

Attributes inherited from Column::View

#sort_order

Instance Method Summary collapse

Methods inherited from Column::View

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

Constructor Details

#initialize(column, action_view, admin_assistant, opts = {}) ⇒ View

Returns a new instance of View.



99
100
101
102
# File 'lib/admin_assistant/belongs_to_column.rb', line 99

def initialize(column, action_view, admin_assistant, opts = {})
  super
  @association_target = AssociationTarget.new associated_class
end

Instance Method Details

#assoc_value(assoc_value) ⇒ Object



104
105
106
# File 'lib/admin_assistant/belongs_to_column.rb', line 104

def assoc_value(assoc_value)
  @association_target.assoc_value assoc_value
end

#associated_classObject



108
109
110
# File 'lib/admin_assistant/belongs_to_column.rb', line 108

def associated_class
  @column.associated_class
end

#association_foreign_keyObject



112
113
114
# File 'lib/admin_assistant/belongs_to_column.rb', line 112

def association_foreign_key
  @column.association_foreign_key
end

#options_for_selectObject



120
121
122
# File 'lib/admin_assistant/belongs_to_column.rb', line 120

def options_for_select
  @association_target.options_for_select
end

#value(record) ⇒ Object



116
117
118
# File 'lib/admin_assistant/belongs_to_column.rb', line 116

def value(record)
  assoc_value record.send(name)
end