Sha256: daf90041726d215ead0589b670fa3cdf1a2eadaf2e3dc9ef1a47c98f16ee09ae
Contents?: true
Size: 597 Bytes
Versions: 5
Compression:
Stored size: 597 Bytes
Contents
module Recommendable class Stash < ActiveRecord::Base self.table_name = 'recommendable_stashes' attr_accessible :user_id, :stashable_id, :stashable_type belongs_to :user, :class_name => Recommendable.user_class.to_s, :foreign_key => :user_id belongs_to :stashable, :polymorphic => :true validates :user_id, :uniqueness => { :scope => [:stashable_id, :stashable_type], :message => "has already stashed this item" } def stashable_type=(sType) super sType.to_s.classify.constantize.base_class.to_s end end end
Version data entries
5 entries across 5 versions & 1 rubygems