0

I have a free text field defines as follows

t.text :freeText

in the gui it is defined

<p>
  <b>Freetext:</b>
  <%= @recipe.freeText %>
</p>

I get a textfield on the html. I want to be able to present large input text with multiline (kind of like JTextArea instead of JTextField). How do I declare it?

4

1 回答 1

0

您可以使用text_area标签助手,如下所示:

<% form_for(@recipe) do |f| %>
    <%= f.text_area :freeText, :html => {:cols => "40", :rows => "10"} %> 
<% end %>

顺便说一句,请阅读 Ruby 风格指南以了解如何正确命名变量(以及其他内容)。以下来自 GitHub 的内容很棒

于 2012-04-29T21:59:39.493 回答