Class: Raw::RefersToControl
- Inherits:
-
RelationControl
- Object
- Element
- Control
- AttributeControl
- RelationControl
- Raw::RefersToControl
- Defined in:
- lib/raw/control/relation/refers_to.rb
Overview
RefersTo. Also used for BelongsTo.
Instance Attribute Summary
Attributes inherited from AttributeControl
Attributes included from ElementMixin
#_children, #_parent, #_text, #_view, #id
Instance Method Summary collapse
Methods inherited from RelationControl
Methods inherited from AttributeControl
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, #initialize, #open, #render_children
Constructor Details
This class inherits a constructor from Raw::RelationControl
Instance Method Details
#emit_options ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/raw/control/relation/refers_to.rb', line 18 def objs = rel.target_class.all selected = selected.pk if selected = value %{ <option value="">--</option> #{(:labels => objs.map{|o| o.to_s}, :values => objs.map{|o| o.pk}, :selected => selected)} } end |
#render ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/raw/control/relation/refers_to.rb', line 9 def render %{ #{emit_label} <select id="#{control_id}" name="#{rel.name}"#{emit_disabled}> #{} </select> } end |