Note that there are some explanatory texts on larger screens.

plurals
  1. PORails - Multiple file upload form with additional input for each file
    primarykey
    data
    text
    <p>I'm working on an app at work where users can upload files to a project. Right now I'm using paperclip, and all of the file info (name, file type, etc.) is recorded properly. </p> <p>The problem I'm having is that the users need to assign a category to each file. </p> <p>What is the best approach to implement something like this? I'm on my phone right now, but I'll attach any pertinent code when I get to work, if necessary. </p> <p>Thanks in advance! </p> <p><strong>EDIT</strong> Here's more info on the setup.<br> I need to assign the file type (which is more like a category than a file type. I didn't name the fields!) So all of the info is in a single table. Although <code>accepts_nested_attributes</code> will definitely come in handy down the road!</p> <p>Here's the table structure. All of the <code>document_</code> fields are set by paperclip. The only one that needs user input is the <code>file_type</code> field.</p> <pre><code>+-----------------------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-----------------------+--------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | document_file_name | varchar(255) | YES | | NULL | | | document_content_type | varchar(255) | YES | | NULL | | | document_file_size | int(11) | YES | | NULL | | | document_updated_at | datetime | YES | | NULL | | | project_id | int(11) | YES | MUL | NULL | | | user_id | int(11) | YES | MUL | NULL | | | file_type | varchar(255) | YES | | NULL | | | created_at | datetime | NO | | NULL | | | updated_at | datetime | NO | | NULL | | +-----------------------+--------------+------+-----+---------+----------------+ </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload