Sha256: af64d21aaadc8f2ddf57a86ab5964be4525971fc6831be6a3f4666fc9df82d1c
Contents?: true
Size: 935 Bytes
Versions: 8
Compression:
Stored size: 935 Bytes
Contents
<% def input_by_col(key, col) case col.type when :integer if key.to_s =~ /_id$/ if model.reflect_on_association(key.sub(/_id$/, '').to_sym) "= f.input :#{key.sub(/_id$/, '')}" else if key.to_s =~ /_type/ "= f.input :#{key}, :collection => #{key.sub(/_type.*/, '').camelize}Type.all" else "= f.input :#{key}" end end else "= f.input :#{key}" end when :string "= f.input :#{key}" when :boolean "= f.input :#{key}" when :text nil else "= f.input :#{key}" end end -%> <% translated_columns.each do |col| -%> <% next if [:description].include?(col.to_sym) -%> = f.input :<%= col %> <% end -%> <% model.columns_hash.except('id', 'slug').each do |key, col| -%> <%= input_by_col(key, col) %> <% end -%>
Version data entries
8 entries across 4 versions & 1 rubygems