Ruby on Rails Friday, November 1, 2019

"always get errors", show the errors then

El vie., 1 nov. 2019 a las 12:44, tom (<tomabroad@gmail.com>) escribió:
hi,

i want to have one uploader, but 2 forms:

<h3>Upload Single Attachment</h3>
<%= simple_form_for(FolderAttachment.new) do |form| %>
  <%= form.error_notification %>

  <div class="form-inputs">
  <%= form.file_field :singlefile %>
  </div>

  <%= form.input :folder_id , :as => :hidden , :input_html => { :value => @folder_current.id}  if @folder_current %>

  <div class="form-inputs">
  <%= form.input :comment %>
  </div>

  <div class="form-inputs">
  <%= form.input :tags %>
  </div>


  <div class="form-actions">
    <%= form.button :submit %>
  </div>
<% end %>


<h3>Upload Multiple Attachments</h3>
<%= simple_form_for(FolderAttachment.new, :html => { :multipart => true } ) do |form| %>
  <%= form.error_notification %>

  <div class="form-inputs">
  <%= form.file_field :files, multiple: true, name: "folder_attachments[files][]"  %>
  </div>

  <%= form.input :folder_id , :as => :hidden , :input_html => { :value => @folder_current.id}  if @folder_current %>

  <div class="form-actions">
    <%= form.button :submit %>
  </div>
<% end %>



--> no matter what i do, i always get errors on controller leve, eg: map or others. can an uploader only have 1 mount?

class FolderAttachment < ApplicationRecord

belongs_to :folder


  mount_uploaders  :singlefile, FolderAttachmentUploader

mount_uploaders  :files, FolderAttachmentUploader



end

thx

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CADQqhMenWxfarO9dCY%2B1N98tmMQuXtysykGj58tV%2B83pqNUEOA%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAPS3bcBWMT3HcLG%2B3%2BN01DfkcRju6Rp5jz%3D%2BaSnyaOZh_XcRCA%40mail.gmail.com.

No comments:

Post a Comment