Hi,
I have a Photo table like this
id
image_url
title
I hope I can use file_column to load image. The problem is file_column
only
supports one file. I know I can create multi columns in the table to
load multi files using
file_column but I only want one column and I want the files being
uploaded to save into different record instead of one photo record.
Is anyway I can define a virtual attribute like this?
class Photo < ActiveRecord
file_column :image_url #image_url will be a real
column
file_column :virtual_url_1 #this is not a table
column, just a holder for file
file_column :virtual_url_2 #this is not a table
column, just a holder for file
def virtual_url_1(value)
save the second file into a new photo record
end
def virtual_url_2(value)
save the third file into a new photo record
end
end
I tried this but it seems not working, could anyone give me
suggestions on how to solve this problem?
thanks/chong