Generated scaffolding for model via Rails

This commit is contained in:
Prelang Builder
2014-02-27 23:58:57 +00:00
committed by u7482
parent 9921d3b6d6
commit aec5ca5c47
14 changed files with 209 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
<%= form_for(@question) do |f| %>
<% if @question.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@question.errors.count, "error") %> prohibited this question from being saved:</h2>
<ul>
<% @question.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="field">
<%= f.label :title %><br>
<%= f.text_area :title %>
</div>
<div class="actions">
<%= f.submit %>
</div>
<% end %>
+6
View File
@@ -0,0 +1,6 @@
<h1>Editing question</h1>
<%= render 'form' %>
<%= link_to 'Show', @question %> |
<%= link_to 'Back', questions_path %>
+27
View File
@@ -0,0 +1,27 @@
<h1>Listing questions</h1>
<table>
<thead>
<tr>
<th>Title</th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<% @questions.each do |question| %>
<tr>
<td><%= question.title %></td>
<td><%= link_to 'Show', question %></td>
<td><%= link_to 'Edit', edit_question_path(question) %></td>
<td><%= link_to 'Destroy', question, method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</tbody>
</table>
<br>
<%= link_to 'New Question', new_question_path %>
+4
View File
@@ -0,0 +1,4 @@
json.array!(@questions) do |question|
json.extract! question, :id, :title
json.url question_url(question, format: :json)
end
+5
View File
@@ -0,0 +1,5 @@
<h1>New question</h1>
<%= render 'form' %>
<%= link_to 'Back', questions_path %>
+9
View File
@@ -0,0 +1,9 @@
<p id="notice"><%= notice %></p>
<p>
<strong>Title:</strong>
<%= @question.title %>
</p>
<%= link_to 'Edit', edit_question_path(@question) %> |
<%= link_to 'Back', questions_path %>
+1
View File
@@ -0,0 +1 @@
json.extract! @question, :id, :title, :created_at, :updated_at