voormedia/rails-erd

View on GitHub
examples/applications/spree/models/preference.rb

Summary

Maintainability
A
0 mins
Test Coverage
class Preference < ActiveRecord::Base
  belongs_to  :owner, :polymorphic => true
  belongs_to  :group, :polymorphic => true

  validates :name, :owner_id, :owner_type, :presence => true
  validates :group_type, :presence => true, :if => :group_id?
end