Suppose I have a polymorphic structure like this. map.resources :bar, :has_many => :foo map.resources :baz, :has_many => :foo
I have articles, pr开发者_Python百科ofiles, and comments. There is a polymorphic association between articles/profiles and comments called commentable.
I have a polymorphic model Comment that can be related to many types of commentables. in my routs, for example I have:
What is the name for the technique of using a set of foreign keys in a table where all but one are NULL for a given row?
I\'m designing a small database for a personal project, and one of the tables, call it table C, needs to have a foreign key to one of two tables, call them A and开发者_运维问答 B, differing by entry.W
class Transaction < ActiveRecord::Base belongs_to :account, :polymorphic => true end class Bankaccount < ActiveRecord::Base
I have following comments table in my app: comments ------开发者_JAVA百科-- idINT foreign_idINT modelTEXT
Consider a class: class Link < ActiveRecord::Base has_many :link_votes, :as => :vote_subject, :class_name => \'Vote\'
Folks, Want to make sure I understand this correctly. And please disregard the case for inheritance here (SentientBeing), trying to instead focus on polymorphic models in has_many :through relationsh