howdy!
i have got two models: a photo model and a lightbox ( a group of photos)
model.
they look like this:
class Lightbox < ActiveRecord::Base
acts_as_taggable
has_and_belongs_to_many :photos
end
class Photo < ActiveRecord::Base
acts_as_taggable
validates_presence_of :filename
has_and_belongs_to_many :lightboxes
end
and my db migration looks like this:
class CreateLightboxes < ActiveRecord::Migration
def self.up
create_table “lightboxes” do |t|
t.column “description”, :text
t.column “name”, :string
t.column “created_at”, :date
end
create_table("lightboxes_photos", :id=>false) do |t|
t.column "lightbox_id", :integer
t.column "photo_id", :integer
end
end
def self.down
drop_table “lightboxes”
drop_table “lightboxes_photos”
end
end
how can i add a photo to a lightbox?
i you need more code to help me just tell me
thanks for your help
flo