aboutsummaryrefslogtreecommitdiffstats
path: root/guides/code/getting_started/app/views/articles/_form.html.erb
diff options
context:
space:
mode:
Diffstat (limited to 'guides/code/getting_started/app/views/articles/_form.html.erb')
-rw-r--r--guides/code/getting_started/app/views/articles/_form.html.erb27
1 files changed, 27 insertions, 0 deletions
diff --git a/guides/code/getting_started/app/views/articles/_form.html.erb b/guides/code/getting_started/app/views/articles/_form.html.erb
new file mode 100644
index 0000000000..87e3353ed2
--- /dev/null
+++ b/guides/code/getting_started/app/views/articles/_form.html.erb
@@ -0,0 +1,27 @@
+<%= form_for @article do |f| %>
+ <% if @article.errors.any? %>
+ <div id="error_explanation">
+ <h2><%= pluralize(@article.errors.count, "error") %> prohibited
+ this article from being saved:</h2>
+ <ul>
+ <% @article.errors.full_messages.each do |msg| %>
+ <li><%= msg %></li>
+ <% end %>
+ </ul>
+ </div>
+ <% end %>
+ <p>
+ <%= f.label :title %><br>
+ <%= f.text_field :title %>
+ </p>
+
+ <p>
+ <%= f.label :text %><br>
+ <%= f.text_area :text %>
+ </p>
+
+ <p>
+ <%= f.submit %>
+ </p>
+<% end %>
+