Created
November 21, 2019 19:18
-
-
Save limjinsun/96edf05a74c94e8f0e7b56c41e1dae9d to your computer and use it in GitHub Desktop.
루비온레일즈 폼오토제너레이션 액티브레코드와 연동
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <%= form_with(model: school, local: true) do |form| %> | |
| <% if school.errors.any? %> | |
| <div id="error_explanation"> | |
| <h2><%= pluralize(school.errors.count, "error") %> prohibited this school from being saved:</h2> | |
| <ul> | |
| <% school.errors.full_messages.each do |message| %> | |
| <li><%= message %></li> | |
| <% end %> | |
| </ul> | |
| </div> | |
| <% end %> | |
| <% for attribute in school.attributes.keys %> | |
| <div class="field"> | |
| <%= form.label attribute.humanize.downcase %> | |
| <%= form.text_field attribute.humanize.downcase, :value => school.attributes[attribute].to_s %> | |
| </div> | |
| <% end %> | |
| <div class="actions"> | |
| <%= form.submit %> | |
| </div> | |
| <% end %> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <p id="notice"><%= notice %></p> | |
| <% @schools.each do |school| %> | |
| <table> | |
| <thead> | |
| <tr> | |
| <td>key</td> | |
| <td>value</td> | |
| </tr> | |
| </thead> | |
| <tbody> | |
| <% for attribute in school.attributes.keys %> | |
| <tr> | |
| <td><%= attribute.humanize %> </td> | |
| <td><%= school.attributes[attribute].to_s %></td> | |
| </tr> | |
| <% end %> | |
| <tr> | |
| <td> | |
| <b><%= link_to 'Show', school %></b> | |
| <b><%= link_to 'Edit', edit_school_path(school) %></b> | |
| <b><%= link_to 'Destroy', school, method: :delete, data: { confirm: 'Are you sure?' } %></b> | |
| </td> | |
| </tr> | |
| </tbody> | |
| </table> | |
| <hr> | |
| <hr> | |
| <hr> | |
| <% end %> | |
| <h1 class="title"><%= link_to 'New School', new_school_path %></h1> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <p id="notice"><%= notice %></p> | |
| <table> | |
| <thead> | |
| <tr> | |
| <td>key</td> | |
| <td>value</td> | |
| </tr> | |
| </thead> | |
| <tbody> | |
| <% for attribute in @school.attributes.keys %> | |
| <tr> | |
| <td><%= attribute.humanize %></td> | |
| <td><%= @school.attributes[attribute].to_s %></td> | |
| </tr> | |
| <% end %> | |
| <tr> | |
| <td> | |
| <%= link_to 'Edit', edit_school_path(@school) %> | | |
| <%= link_to 'Back', schools_path %> | |
| </td> | |
| </tr> | |
| </tbody> | |
| </table> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment