Sha256: d11cbb6a58f8f98d63f9bc4aab969f9b7ac0d93d4f80bdfb4a8717462c44b797
Contents?: true
Size: 1.12 KB
Versions: 12
Compression:
Stored size: 1.12 KB
Contents
module Puffer module Inputs class Association < Puffer::Inputs::Base def input <<-INPUT <div class="association"> #{text_field_tag field, value, field.input_options.merge( :autocomplete => :off, :disabled => (true if builder.object.send(field.name)), 'data-autocompleter' => "{url: '#{resource.collection_path(:action => "associated_#{field}_choosing")}', onDone: association_done}" )} <div class="association_clear">×</div> #{builder.hidden_field field.reflection.primary_key_name} </div> INPUT end def value value = [ swallow_nil{builder.object.send(field.name)[field.reflection.primary_key_column.name.to_sym]}, swallow_nil{builder.object.send(field.name).to_title} ].compact.join(' - ') end def label label_tag field end def error builder.object.errors[field.reflection.primary_key_name.to_sym].first || builder.object.errors[field.name.to_sym].first.presence end end end end
Version data entries
12 entries across 12 versions & 1 rubygems