Top "Polymorphic-associations" questions

Polymorphic association is a term used in discussions of Object-Relational Mapping with respect to the problem of representing in the relational database domain, a relationship from one class to multiple classes.

Is it possible to create a conditional association in model?

I have setup a role based access controll system with the following models: Role (as STI), UserRole (global roles) ProjectRole (…

ruby-on-rails conditional has-many polymorphic-associations single-table-inheritance
Something like inheritance in database design

Suppose you were setting up a database to store crash test data of various vehicles. You want to store data …

database-design polymorphic-associations class-table-inheritance
Rails: has_many through with polymorphic association - will this work?

A Person can have many Events and each Event can have one polymorphic Eventable record. How do I specify the …

ruby-on-rails activerecord has-many-through polymorphic-associations
MYSQL join tables based on column data and table name

I'm wondering if this its even posible. I want to join 2 tables based on the data of table 1. Example table 1 …

mysql join polymorphic-associations
Association for polymorphic belongs_to of a particular type

I'm relatively new to Rails. I would like to add an association to a model that uses the polymorphic association, …

ruby-on-rails ruby-on-rails-3 polymorphic-associations
Ruby on Rails: :include on a polymorphic association with submodels

When working with a polymorphic association, is it possible to run an include on submodels that are only present in …

ruby-on-rails include polymorphic-associations eager-loading rails-activerecord
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 => :…

ruby-on-rails polymorphic-associations
Rails Polymorphic has_many

Using Ruby on Rails, how can I achieve a polymorphic has_many relationship where the owner is always of a …

ruby-on-rails associations polymorphic-associations
Laravel Eloquent polymorphic one-to-one?

I'm trying to setup a polymorphic one-to-one relationship (the polymorphic equivalent of has_one and belongs_to).I've got an …

laravel laravel-4 eloquent polymorphic-associations
Remove Model and Table so can start again in Rails

I created a model for comments at the start of a project, but have now come to the realisation I …

ruby-on-rails models polymorphic-associations rails-migrations destroy