Class: ActionView::Helpers::FormBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/optimism.rb

Instance Method Summary collapse

Instance Method Details

#container_for(attribute, **options, &block) ⇒ Object



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

def container_for(attribute, **options, &block)
  @template.tag.div @template.capture(&block), **options.merge(id: container_id_for(attribute)) if block_given?
end

#container_id_for(attribute) ⇒ Object



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

def container_id_for(attribute)
  Optimism.container_selector.sub("RESOURCE", object_name.to_s.delete("]").tr("[", "_")).sub("ATTRIBUTE", attribute.to_s)[1..-1]
end

#error_for(attribute, **options) ⇒ Object



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

def error_for(attribute, **options)
  @template.error_for(object_name, attribute, **options)
end