I have this schema: class Comment has_many :ratings, :as => :target end class Rating belongs_to :target, :polymorphic => true
So, if I have a polymorphic association throughout my application, is there a way to add methods to it?For instance, if :post, :photo and :user are all associated to :rankings with a polymo开发者_如何
I\'m adding tags to several models (Posts, Articles, Photos, etc).I\'m aware of rails tagging plugins but prefer not to use them, as they don\'t quite meet my specific needs.
i have table AuditLog with fields including: audited_id | audited_type That results in data like: 108 | Photo
I have a couple classes that can each have comments: class Movie < ActiveRecord::Base has_many :comments, :as => :commentable
How do you eager load polymorphic has_many :through associations in Rails/ActiveRecord? Here\'s the base setup:
I have the usual polymorphic associations for comments: class Book < ActiveRecord::Base has_many :comments, :as => :commentable
Here\'s what I\'m thinking: class Widget < ActiveRecord::Base has_one :widget_la开发者_Go百科yout
I have two models (Item and Theme).They are both owned by a third model Users with a has_many association (User has many Themes and Items). Both Item and Theme have_many :images.
Update : Gutted entire question with more thorough description Ok same question with different names.