app/models/recommendable/stash.rb in recommendable-0.2.1.1 vs app/models/recommendable/stash.rb in recommendable-1.0.0
- old
+ new
@@ -6,9 +6,10 @@
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