Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. class Site < ApplicationRecord
  2. serialize :steps, Array
  3. end
  4.  
  5.  
  6. <table class="listing" summary="Site list">
  7. <tr class="header">
  8. <th>Name</th>
  9. <th>Step 1</th>
  10. <th>Step 2</th>
  11. <th>Step 3</th>
  12. <th>Actions</th>
  13. </tr>
  14. <% @sites.each do |site| %>
  15. <tr>
  16. <td><%= site.name %></td>
  17. <% site.steps.each do |step| %>
  18. <td><%= step %></td>
  19. <% end %>
  20. <td class="actions">
  21. <%= link_to("Show", site_path(site), :class => 'action show') %>
  22. <%= link_to("Edit", edit_site_path(site), :class => 'action edit') %>
  23. <%= link_to("Delete", delete_site_path(site), :class => 'action delete') %>
  24. </td>
  25. </tr>
  26. <% end %>
  27. </table>
  28.  
  29. <%= form_for(@site) do |f| %>
  30.  
  31. <table summary="Site form fields">
  32. <tr>
  33. <th>Name</th>
  34. <td><%= f.text_field(:name) %></td>
  35. </tr>
  36. <% a=1 %>
  37. <% @site.steps.each do |step| %>
  38. <tr>
  39. <th>Step <%= a %>
  40. <td><%= text_field :site, :steps, :value => step %></td>
  41. <% a += 1 %>
  42. </tr>
  43. <% end %>
  44. </table>
  45.  
  46. <div class="form-buttons">
  47. <%= f.submit("Update Site") %>
  48. </div>
  49.  
  50. <% end %>
  51.  
  52. Attribute was supposed to be a Array, but was a String.
  53.  
  54. <%= f.text_field(:steps, { multiple: true, value: @site.steps[step] }) %>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement