Sha256: b71d12801252d0d26bf4c435c08d53dbaaf882fe52afca22fd8309f6c994efa5
Contents?: true
Size: 1.01 KB
Versions: 3
Compression:
Stored size: 1.01 KB
Contents
module Trestle class Form class Automatic < Form def initialize(admin) @block = Proc.new do admin.default_attributes.each do |attribute| next if attribute.primary_key? next if attribute.inheritance_column? next if attribute.counter_cache? case attribute.type when :association options = attribute.association_class.all.map { |instance| [display(instance), instance.id] } prompt = "- Select #{admin.model.human_attribute_name(attribute.association_name)} -" select attribute.name, options, include_blank: prompt when :text text_area attribute.name when :date date_field attribute.name when :datetime datetime_field attribute.name when :boolean check_box attribute.name else text_field attribute.name end end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
trestle-0.8.3 | lib/trestle/form/automatic.rb |
trestle-0.8.2 | lib/trestle/form/automatic.rb |
trestle-0.8.0 | lib/trestle/form/automatic.rb |