Forum: Ruby on Rails Get colum types in auto form

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
4710a8ada2adc162aaee4288d9879d8e?d=identicon&s=25 Gerard Petersen (Guest)
on 2006-01-22 10:42
(Received via mailing list)
Hi all,

I'm trying to build a routine that generates table rows with the
field types (text_area and text_field for now), and filters out the
'created_at' and 'deleted_at'.

  <% for column in Project.content_columns %>
    <tr class="ListLine<%= cycle("0","1") %>">
    <td><%= column.human_name %>:</td>
	## The line below
    <% if column.string %>
        <td><%= text_field 'project',  %></td>
    <% elsif column.text %>
	<td><%= text_area 'project',  %></td>
    <% end %>

Is there a cleaner way then doing and elsif sequence, and what is the
attribute name ('type' in this case) of a column. Been messing with
column.string but that doesn't work.

Thanx n Greetz


"Who cares if it doesn't do anything?  It was made with our new
Triple-Iso-Bifurcated-Krypton-Gate-MOS process ..."

My $Grtz =~ Gerard;
This topic is locked and can not be replied to.