Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I am just doing the layout for my app at the moment and I want to insert a text.field that does nothing just to see how it looks. How can I do this?

like image 564
user852974 Avatar asked Sep 24 '11 01:09

user852974


1 Answers

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 %>
like image 54
PeterWong Avatar answered Nov 08 '22 06:11

PeterWong