Sha256: 9a14f4066f9ed15a3fc09a91a8ae91c28217d5867c7b6ce7a6a7eed8486cd24e

Contents?: true

Size: 1014 Bytes

Versions: 64

Compression:

Stored size: 1014 Bytes

Contents

# FIXME not needed here, since this is only used in the views InlineForms::SPECIAL_COLUMN_TYPES[:info]=:string

def infoadmin_show(object, attribute)
  object.send(attribute)._presentation rescue  ''
end

def infoadmin_edit(object, attribute)
  object.send('build_' + attribute.to_s) unless object.send(attribute)
  o = object.send(attribute).class.name.constantize
  if cancan_enabled?
    values = o.accessible_by(current_ability).order(o.order_by_clause)
  else
    values = o.order(o.order_by_clause)
  end
  # 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.underscore).to_sym, attribute.to_s.foreign_key.to_sym, values, 'id', '_presentation', :selected => object.send(attribute).id)
end

def infoadmin_update(object, attribute)
  object[attribute.to_s.foreign_key.to_sym] = params[('_' + object.class.to_s.underscore).to_sym][attribute.to_s.foreign_key.to_sym]
end

Version data entries

64 entries across 64 versions & 1 rubygems

Version Path
inline_forms-1.2.1 lib/app/helpers/form_elements/infoadmin.rb
inline_forms-1.2.0 lib/app/helpers/form_elements/infoadmin.rb
inline_forms-1.1.20 lib/app/helpers/form_elements/infoadmin.rb
inline_forms-1.1.19 lib/app/helpers/form_elements/infoadmin.rb
inline_forms-1.1.18 lib/app/helpers/form_elements/infoadmin.rb
inline_forms-1.1.17 lib/app/helpers/form_elements/infoadmin.rb
inline_forms-1.1.16 lib/app/helpers/form_elements/infoadmin.rb
inline_forms-1.1.15 lib/app/helpers/form_elements/infoadmin.rb
inline_forms-1.1.13 app/helpers/form_elements/infoadmin.rb
inline_forms-1.1.12 app/helpers/form_elements/infoadmin.rb
inline_forms-1.1.11 app/helpers/form_elements/infoadmin.rb
inline_forms-1.1.10 app/helpers/form_elements/infoadmin.rb
inline_forms-1.1.9 app/helpers/form_elements/infoadmin.rb
inline_forms-1.1.8 app/helpers/form_elements/infoadmin.rb
inline_forms-1.1.7 app/helpers/form_elements/infoadmin.rb
inline_forms-1.1.6 app/helpers/form_elements/infoadmin.rb
inline_forms-1.1.5 app/helpers/form_elements/infoadmin.rb
inline_forms-1.1.4 app/helpers/form_elements/infoadmin.rb
inline_forms-1.1.3 app/helpers/form_elements/infoadmin.rb
inline_forms-1.1.2 app/helpers/form_elements/infoadmin.rb