polymorphic-associations
How can I sort by the average of a polymorphic child's attribute with ActiveRecord 2.3?
I have this schema: class Comment has_many :ratings, :as => :target end class Rating belongs_to :target, :polymorphic => true[详细]
2023-01-19 01:16 分类:问答How to add methods to a rails polymorphic association?
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开发者_如何[详细]
2023-01-18 16:31 分类:问答Adding tags to polymorphic models in rails
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.[详细]
2023-01-18 15:55 分类:问答Rails 3 - polymorphic_path - How to Create One given a table
i have table AuditLog with fields including: audited_id | audited_type That results in data like: 108 | Photo[详细]
2023-01-18 04:28 分类:问答Creating forms for polymorphic associations in Rails
I have a couple classes that can each have comments: class Movie < ActiveRecord::Base has_many :comments, :as => :commentable[详细]
2023-01-16 23:52 分类:问答Eager Load Polymorphic has_many :through Associations in ActiveRecord?
How do you eager load polymorphic has_many :through associations in Rails/ActiveRecord? Here\'s the base setup:[详细]
2023-01-16 17:57 分类:问答Rails: Query to get recent items based on the timestamp of a polymorphic association
I have the usual polymorphic associations for comments: class Book < ActiveRecord::Base has_many :comments, :as => :commentable[详细]
2023-01-15 18:57 分类:问答Is a polymorphic association appropriate here?
Here\'s what I\'m thinking: class Widget < ActiveRecord::Base has_one :widget_la开发者_Go百科yout[详细]
2023-01-15 01:25 分类:问答Ruby: Declarative_authorization polymorphic associations
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.[详细]
2023-01-14 04:32 分类:问答Writing proper validation errors?
Update : Gutted entire question with more thorough description Ok same question with different names.[详细]
2023-01-12 11:13 分类:问答