get the data to work with active_yaml
This commit is contained in:
@ -1,2 +1,2 @@
|
||||
class Image
|
||||
class Image < ActiveYaml::Base
|
||||
end
|
||||
|
@ -1,17 +0,0 @@
|
||||
<%= form_with(model: image) do |form| %>
|
||||
<% if image.errors.any? %>
|
||||
<div style="color: red">
|
||||
<h2><%= pluralize(image.errors.count, "error") %> prohibited this image from being saved:</h2>
|
||||
|
||||
<ul>
|
||||
<% image.errors.each do |error| %>
|
||||
<li><%= error.full_message %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div>
|
||||
<%= form.submit %>
|
||||
</div>
|
||||
<% end %>
|
@ -1,2 +0,0 @@
|
||||
<div id="<%= dom_id image %>">
|
||||
</div>
|
@ -1,10 +0,0 @@
|
||||
<h1>Editing image</h1>
|
||||
|
||||
<%= render "form", image: @image %>
|
||||
|
||||
<br>
|
||||
|
||||
<div>
|
||||
<%= link_to "Show this image", @image %> |
|
||||
<%= link_to "Back to images", images_path %>
|
||||
</div>
|
@ -1,14 +0,0 @@
|
||||
<p style="color: green"><%= notice %></p>
|
||||
|
||||
<h1>Images</h1>
|
||||
|
||||
<div id="images">
|
||||
<% @images.each do |image| %>
|
||||
<%= render image %>
|
||||
<p>
|
||||
<%= link_to "Show this image", image %>
|
||||
</p>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<%= link_to "New image", new_image_path %>
|
@ -1,9 +0,0 @@
|
||||
<h1>New image</h1>
|
||||
|
||||
<%= render "form", image: @image %>
|
||||
|
||||
<br>
|
||||
|
||||
<div>
|
||||
<%= link_to "Back to images", images_path %>
|
||||
</div>
|
@ -1,10 +0,0 @@
|
||||
<p style="color: green"><%= notice %></p>
|
||||
|
||||
<%= render @image %>
|
||||
|
||||
<div>
|
||||
<%= link_to "Edit this image", edit_image_path(@image) %> |
|
||||
<%= link_to "Back to images", images_path %>
|
||||
|
||||
<%= button_to "Destroy this image", @image, method: :delete %>
|
||||
</div>
|
@ -1,3 +1,4 @@
|
||||
Rails.application.routes.draw do
|
||||
resources :images
|
||||
root to: "images#show" , id: 1
|
||||
end
|
||||
|
7
test/dummy/images.yml
Normal file
7
test/dummy/images.yml
Normal file
@ -0,0 +1,7 @@
|
||||
- id: 1
|
||||
name: US
|
||||
- id: 2
|
||||
name: Canada
|
||||
- id: 3
|
||||
name: Mexico
|
||||
|
Reference in New Issue
Block a user