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
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---