Sha256: 6640c5850dfba89fe40334db5cc933dca50bd3b96c6262078190b9e645145c9d
Contents?: true
Size: 932 Bytes
Versions: 26
Compression:
Stored size: 932 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
26 entries across 19 versions & 1 rubygems