Editing File

<%= form_for(@file, html: { class: 'square' }) do |f| %> <%= render 'shared/errors', messages: @file.errors.full_messages %> <%= cascade @file, ["name", "size_s", "md5_s"] %>
<%= f.label :description %> <%= f.text_field :description %>
<%= f.label :directory_id %> <%= f.select :directory_id, Directory.path_sorted.collect { |c| ["#{c.full_title} (#{c.relative_path})", c.id] } %>
<%= f.submit 'Update' %>
<% end %>

Related Files

<% @file.related_files.each do |related| %> <% end %>
Name Size Action
<%= h related.name.filename %> <%= related.size_s %> MB <%= link_to "Remove", controller: "data_files", action: "delFile", id: @file, "related_id" => related %>
<%= form_for @file, url: { action: "addFile", id: @file } do |f| %>
<%= f.select :related_id, @file.directory.files.not(@file).collect {|file| [file, file.id]} %>
<%= f.submit "Add" %>
<% end %>