#Vote Model belongs_to :voteable, :polymorphic => true belongs_to :voter, :polymorphic => true #votes table
I\'m writing some tricky polymorphic relationships to handle tagging. I have a Tag model, and a Tagging model which belongs_to a polymorphic taggable.
The usual way of setting a foreign key constraint is to choose which table the foreign key will point to.
I have Rails polymorph开发者_开发百科ic model and I want to apply different validations according to associated class. The class name is in the _type column for instance in the following setup:
Using Ruby on Rails, how can I achieve a polymorphic has_many relationship where the owner is always of a known but the items in the association will be of some polymorphic (but homogenous) type, spec
I have everything on my polymorphic associations working, but if I have model validations, the erros don\'t show up.
I have a polymorphic association that looks like this: class Line < ActiveRecord::Base belongs_to :item, :polymorphic => true
Sorry for the title, it\'s difficult to explain. I need a data model similar to this: As you can see, a set can belong to both a user or a school. My problem: It should only be allowed to belong ei
I have two models: cars and pictures in my RoR project class Car < ActiveRecord::Base has_many :pictures, :as => :imageable, :dependent => :destroy
I have two models, users and themes, that I\'m currently joining in a HABTM association in a themes_users table. Basically, after a user creates a new theme, it becomes available to other users to sel