Generated scaffolding for model via Rails
This commit is contained in:
@@ -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 %>
|
||||
@@ -0,0 +1,6 @@
|
||||
<h1>Editing question</h1>
|
||||
|
||||
<%= render 'form' %>
|
||||
|
||||
<%= link_to 'Show', @question %> |
|
||||
<%= link_to 'Back', questions_path %>
|
||||
@@ -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 %>
|
||||
@@ -0,0 +1,4 @@
|
||||
json.array!(@questions) do |question|
|
||||
json.extract! question, :id, :title
|
||||
json.url question_url(question, format: :json)
|
||||
end
|
||||
@@ -0,0 +1,5 @@
|
||||
<h1>New question</h1>
|
||||
|
||||
<%= render 'form' %>
|
||||
|
||||
<%= link_to 'Back', questions_path %>
|
||||
@@ -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 %>
|
||||
@@ -0,0 +1 @@
|
||||
json.extract! @question, :id, :title, :created_at, :updated_at
|
||||
Reference in New Issue
Block a user