Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Site < ApplicationRecord
- serialize :steps, Array
- end
- <table class="listing" summary="Site list">
- <tr class="header">
- <th>Name</th>
- <th>Step 1</th>
- <th>Step 2</th>
- <th>Step 3</th>
- <th>Actions</th>
- </tr>
- <% @sites.each do |site| %>
- <tr>
- <td><%= site.name %></td>
- <% site.steps.each do |step| %>
- <td><%= step %></td>
- <% end %>
- <td class="actions">
- <%= link_to("Show", site_path(site), :class => 'action show') %>
- <%= link_to("Edit", edit_site_path(site), :class => 'action edit') %>
- <%= link_to("Delete", delete_site_path(site), :class => 'action delete') %>
- </td>
- </tr>
- <% end %>
- </table>
- <%= form_for(@site) do |f| %>
- <table summary="Site form fields">
- <tr>
- <th>Name</th>
- <td><%= f.text_field(:name) %></td>
- </tr>
- <% a=1 %>
- <% @site.steps.each do |step| %>
- <tr>
- <th>Step <%= a %>
- <td><%= text_field :site, :steps, :value => step %></td>
- <% a += 1 %>
- </tr>
- <% end %>
- </table>
- <div class="form-buttons">
- <%= f.submit("Update Site") %>
- </div>
- <% end %>
- Attribute was supposed to be a Array, but was a String.
- <%= f.text_field(:steps, { multiple: true, value: @site.steps[step] }) %>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement