Sha256: 019c2dcc431e5d225bcf34b5d4567febd7ddc282880a5e57110cfb34b78a1d98
Contents?: true
Size: 802 Bytes
Versions: 8
Compression:
Stored size: 802 Bytes
Contents
module InlineFormsHelper InlineForms::SPECIAL_MIGRATION_TYPES[:dropdown_with_values]=:integer # dropdown_with_values def dropdown_with_values_show(object, attribute, values) link_to_inline_edit object, attribute, values[object.send(attribute)], values end def dropdown_with_values_edit(object, attribute, values) # the leading underscore is to avoid name conflicts, like 'email' and 'email_type' will result in 'email' and 'email[email_type_id]' in the form! collection_select( ('_' + object.class.to_s.downcase).to_sym, attribute.to_sym, values, 'first', 'last', :selected => object.send(attribute)) end def dropdown_with_values_update(object, attribute, values) object[attribute.to_sym] = params[('_' + object.class.to_s.downcase).to_sym][attribute.to_sym] end end
Version data entries
8 entries across 8 versions & 1 rubygems