class ModelBase::ColumnAttribute::AbstractSelectRenderer
Attributes
column_attr[R]
Public Class Methods
new(column_attr)
click to toggle source
# File lib/model_base/column_attribute.rb, line 156 def initialize(column_attr) @column_attr = column_attr end
Public Instance Methods
render(form_name, target_name, options = {})
click to toggle source
# File lib/model_base/column_attribute.rb, line 160 def render(form_name, target_name, options = {}) html = options.delete(:html) || {} html_exp = html.empty? ? nil : html.inspect.gsub(/\A\{|\}\z/, '') options.update(include_blank: true) if !column_attr.required? options_exp = '{%s}' % options.map{|k,v| "#{k}: #{v.inspect}"}.join(', ') r = render_core(form_name, target_name) r << ", #{options_exp}" r << ", #{html_exp}" unless html.empty? r end