app/models/personal_recommendation.rb in muck-services-0.1.39 vs app/models/personal_recommendation.rb in muck-services-0.1.40
- old
+ new
@@ -11,13 +11,17 @@
# created_at :datetime
# visited_at :datetime
#
class PersonalRecommendation < ActiveRecord::Base
-
+ unloadable
+
belongs_to :personal_recommendable, :polymorphic => true
belongs_to :destination, :polymorphic => true
-
+
+ belongs_to :entry, :class_name => 'Entry', :foreign_key => 'destination_id', :include => :feed
+ belongs_to :user, :class_name => 'User', :foreign_key => 'destination_id'
+
named_scope :limit, lambda { |num| { :limit => num } }
named_scope :recent, lambda { { :conditions => ['created_at > ?', 1.week.ago] } }
named_scope :newest, :order => "created_at DESC"
named_scope :entries_only, :conditions => ["personal_recommendations.destination_type = 'Entry'"]
named_scope :users, :conditions => ["personal_recommendations.destination_type = 'User'"]