Class: Raw::RelationControl

Inherits:
AttributeControl show all
Defined in:
lib/raw/control/relation.rb

Overview

The base class for controls used to inspect object relations. – FIXME: this is a temp hack. TODO: Fix mismatches with attributes. ++

Direct Known Subclasses

HasManyControl, RefersToControl

Instance Attribute Summary

Attributes inherited from AttributeControl

#anno, #attribute, #value

Attributes included from ElementMixin

#_children, #_parent, #_text, #_view, #id

Instance Method Summary collapse

Methods included from XhtmlHelper

#date_select, #datetime_select, #hidden, #href_of, #js_popup, #link_to, #objects_to_options, #onclick_popup, #options, #popup, #submit, #time_select

Methods included from ElementMixin

#add_child, #close, #content, #include, #open, #render, #render_children

Constructor Details

#initialize(object, rel, options) ⇒ RelationControl

Input

  • object = the object to inspect

  • symbol = the relation symbol

  • anno = the relation annotations

  • options = additional options



21
22
23
24
25
26
# File 'lib/raw/control/relation.rb', line 21

def initialize object, rel, options
  @object = object
  @anno = rel
  @value = options[:value] || object.send(rel.name.to_sym)
  @options = options
end

Instance Method Details

#relObject



32
33
34
# File 'lib/raw/control/relation.rb', line 32

def rel
  @anno
end

#symbolObject



28
29
30
# File 'lib/raw/control/relation.rb', line 28

def symbol
  @anno[:symbol]
end