All,
I’m having trouble wrapping my head around how to associate my IMAGE
model with my PRODUCT model. Basically I have the obligatory fields
for the attachment_fu association:
class CreateImages < ActiveRecord::Migration
def self.up
create_table :images do |t|
t.column :parent_id, :integer
t.column :content_type, :string
t.column :filename, :string
t.column :thumbnail, :string
t.column :size, :integer
t.column :width, :integer
t.column :height, :integer
end
end
def self.down
drop_table :images
end
end
. . .then I have the models associated through “has_many” and
“belongs_to”. What I can’t quite figure out is how to immediately
associate an uploaded image with a product on the same “new” page.
Would I set the “form_for” a PRODUCT and IMAGE independently, or would
I have one nested inside the other? I’m sorry, I’ve been coding for
several hours on end now, and I’m admittedly a bit rusty on my HTML
form handling.
Thanks,
Michael