Forum: Ruby on Rails RE: Re: Creating multiple rows with one form

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Hogan, Brian P. (Guest)
on 2006-03-10 16:35
(Received via mailing list)
I've made file_column work with 3 files at the same time, both stored in
one row.

  Assuming an 'applications' table with the following fields
       id
       cover_letter
       resume
       essay
       applicant_id


 my model would be:

 class Application < ActiveRecord::Base
     file_column :cover_letter
     file_column :resume
     file_column :essay
     belongs_to :applicant
 end


File_column just adds functionality onto an existing AR class, so you
still get to do all of your relationshipss validations, etc. Plus it has
rmagick integration so you can manipulate images if you need that
functionality.  It also handles those situations where save fails... So
you don't have to make your users re-upload the file.
2d515f56506878e44e0c940bc0635bbe?d=identicon&s=25 Szymon N. (g0nzo)
on 2006-03-10 19:56
Hogan, Brian P. wrote:
> I've made file_column work with 3 files at the same time, both stored in
> one row.

Hi,

I've got a bit different situation, as i want to create many rows of the
same object, each for a single file, in one form.

I tried using "'index' => number" on file_column helper method, but i
get:
undefined method `stringify_keys!' for "":String
This topic is locked and can not be replied to.