Sha256: 23113b9b84abc718b57194f9673698f593d72ed30897e263966058d6edb8c59c
Contents?: true
Size: 722 Bytes
Versions: 3
Compression:
Stored size: 722 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" }, :presence => true validates_presence_of :stashable_id validates_presence_of :stashable_type def stashable_type=(sType) super sType.to_s.classify.constantize.base_class.to_s end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
recommendable-1.1.7 | app/models/recommendable/stash.rb |
recommendable-1.1.6 | app/models/recommendable/stash.rb |
recommendable-1.1.5 | app/models/recommendable/stash.rb |