Forum: Ruby on Rails Get colum types in auto form

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Gerard P. (Guest)
on 2006-01-22 11:42
(Received via mailing list)
Hi all,

I'm trying to build a routine that generates table rows with the
appropriate
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', column.name  %></td>
    <% elsif column.text %>
	<td><%= text_area 'project', column.name  %></td>
    <% end %>
    </tr>

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

Gerard.

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

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