search for: polymorpic

Displaying 4 results from an estimated 4 matches for "polymorpic".

Did you mean: polymorphic
2006 Sep 03
7
using polymorphic associations with acts_as_list
This is what I have class Photo < ActiveRecord::Base belongs_to :image, :polymorphic => true acts_as_list :scope => image end class Place < ActiveRecord::Base has_many :photos, :as => :image end class Child < ActiveRecord::Base has_many :photos, :as => :image end I want to be able to reorder the images. What I need is for the position of the photos to be set
2006 May 20
7
Polymorphic, many-to-many, self-referential data model
No matter what I try I''ve been unable to work how to get this to work with the cool ActiveRecord helpers. I''m not sure if it''s possible, Josh Susser''s blog suggests it is, but damned if I can work it out... I have: Container which can contain one or more Element. An Element is a polymorph of either a Container or a Chunk. An Element can exist in one or more
2006 Aug 16
0
Polymorphic Associations and grouping users and projects
...ips end class Membership < ActiveRecord::Base belongs_to :group belongs_to :user end class Group < ActiveRecord::Base has_many :memberships has_many :users, :through => :memberships end What I would like to do is add project groupings to the admin and I think I may need to use polymorpic associations. However I dont know if this is he best option. For someone who is much brighter than me, is the code below the best way to achieve this? class User < ActiveRecord::Base has_many :memberships, :as => :groupabale has_many :groups, :through => :memberships end clas...
2006 Jun 06
1
Please Help with single table inheritance relationships
I''ve been searching the web, wikis, and more, and I haven''t turned up examples of how to have multiple entities in a single-table inheritance related to anything. I have an addresses table, but multiple entities can have Addresses: both Person (which has 2 addresses) and Retailer. I''ve been told that I need to use single-table inheritance, and this was my attempt: