diff --git a/app/models/alert.rb b/app/models/alert.rb index 02f5ce6..db84ded 100644 --- a/app/models/alert.rb +++ b/app/models/alert.rb @@ -23,6 +23,10 @@ class Alert < ActiveRecord::Base } validates :semester, :presence => true + scope :user_alerts, lambda { |user_id| + where('Alerts.user_id = ?', user_id) + } + def alerted? @alerted end @@ -34,8 +38,4 @@ class Alert < ActiveRecord::Base def sections end - - def self.user_alerts(user_id) - Alert.where("user_id = #{user_id}") - end end