Sha256: 9d1401bb10fc970bd33f0c625638a9d071211c53d2fbe41a270a25902793dd44

Contents?: true

Size: 656 Bytes

Versions: 1

Compression:

Stored size: 656 Bytes

Contents

module InlineFormsHelper
  # boolean, bit unaptly named check_box
  def check_box_show(object, attribute, values)
    values ||= { 'false' => 'no', 'true' => 'yes' }
    link_to_inline_edit object, attribute, values[object.send(attribute).to_s], values
  end
  def check_box_edit(object, attribute, values)
    values ||= { 'false' => 'no', 'true' => 'yes' }
    collection_select( object.class.to_s.downcase, attribute, values, 'first', 'last', :selected => object.send(attribute).to_s)
  end
  def check_box_update(object, attribute, values)
    object[attribute.to_s.to_sym] = params[object.class.to_s.downcase.to_sym][attribute.to_s.to_sym]
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
inline_forms-0.5.0 app/helpers/form_elements/check_box.rb