search for: relationable_type

Displaying 1 result from an estimated 1 matches for "relationable_type".

2006 Jun 23
2
polymorphic challenge
...s All these relations are like; User <-> Relation <-> User I was thinking I could have a class called Relation (with a table relations) and use through + polymorphic features. Something in this range; create_table :relations do |t| t.column :user_id, :integer t.column :relationable_type, :string t.column :relationable_id, :string t.column :created_at, :datetime end class Relation < ActiveRecord::Base belongs_to :relationable, :polymorphic => true end class User has_many :favorite_profiles, :as => :relationable, :class_name => "Relation" h...