No..i am not a full time rails developer...i code in pl/sql for paying my bills...and i am just working on a pet project...so i had some trouble in doing..what i specify in the subject.....now somehow i solved this problem...so those interested can look at the code at: http://hemant.wordpress.com/2006/04/25/file_column... I write this mail and [blog]post....so that Amy doesn't call me a Help monster. :)
on 2006-04-25 16:30
on 2006-04-25 17:08
I read your blog post. You seem to be complicating things. It is perfectly valid to have multiple fields in the same table use file_column. Why not just say in your model file_column :picture_1 file_column :picture_2 ... and then simply let file_column work like it's supposed to, complete with file_column_field helpers? hemant kumar wrote: > No..i am not a full time rails developer...i code in pl/sql for paying > my > bills...and i am just working on a pet project...so i had some trouble > in > doing..what i specify in the subject.....now somehow i solved this > problem...so those interested can look at the code at: > > http://hemant.wordpress.com/2006/04/25/file_column... > > I write this mail and [blog]post....so that Amy doesn't call me a Help > monster. :)
on 2006-04-25 17:20
But then i thought in "file_column :picture", picture must be a column in the table, right? and i have only one column to store filenames in my table....correct me, if i am wrong?
on 2006-04-25 17:27
Also is it a good idea to predefine, the number of files that i can upload?....though my current code relies on that..but i am gonna change that...and if in the model class itself i specify how many columns i need then i am stuck there, right?
on 2006-04-25 17:55
If I have a model that requires a variable # of images, I usually just create an additional table called model_images, and then add a :has_many => :model_images (with a corresponding belongs_to :model in the images model) to my model. That way if you need to have metadata about the images (captions, or whatever), you can store that in the images table. This way your # of images is unlimited, and you can just add a :file_column :image or whatever to your images table. Works for me... Matt
on 2006-04-25 17:58
Whoops... Too early... I meant ":file_column :image to your images model"
on 2006-04-25 18:07
yeah...got it....thatz a cool idea....but right now basically pictures table is like your model_images table......and i am storing all the metadata, like Tags and all that in this table itself....
on 2006-04-25 18:23
Yes, you would need a varchar/:string column in your table for each file_column. Sorry, your action name and the post titles confused me. This looks like a method just for adding multiple new image records from a single form. I gather that mutliple instances of <%= file_column_field "picture, "filename" -%> in a single form doesn't work, eh? hemant kumar wrote: > But then i thought in "file_column :picture", picture must be a column > in > the table, right? > and i have only one column to store filenames in my table....correct me, > if > i am wrong?