开发者

Rails: How to insert a text_field without a form just to test the layout?

开发者 https://www.devze.com 2023-04-07 09:24 出处:网络
I am just doing the layout for my app at the moment an开发者_如何转开发d I want to insert a text.field that does nothing just to see how it looks. How can I do this?There are a few ways that could do

I am just doing the layout for my app at the moment an开发者_如何转开发d I want to insert a text.field that does nothing just to see how it looks. How can I do this?


There are a few ways that could do what you want.

1) just write the static HTML

<input type="text" name="dummy" />

2) Using text_field_tag

<%= text_field_tag "dummy", nil %>

3) Building a dummy form using a form_for for a dummy object

<%= form_for SomeModel.new do |f| %>
  <%= f.text_field :column_name %>
<% end %>
0

精彩评论

暂无评论...
验证码 换一张
取 消