Displaying 1 result from an estimated 1 matches for "favorite_imag".
Did you mean:
favorite_images
2006 Jul 10
2
Polymorphic associations in reverse?
...le, :polymorphic => :true
end
class User < ActiveRecord::Base
has_many :images
# Can be a favorite
belongs_to :favorite
belongs_to :favorable, :polymorphic => :true
# Has many favorite ''things''
has_many :favorites, :dependent => :destroy
has_many :favorite_images, :as => :favorable, :through => :favorites,
:classname => "Image"
has_many :favorite_users, :as => :favorable, :through => :favorites,
:classname => "User"
end
class Favorite < ActiveRecord::Base
belongs_to :favorable, :polym...