1
0
Fork 0

Use scope for user_alerts to make it more 'railsy'

This commit is contained in:
Andrew Tomaka 2013-04-06 01:55:37 -04:00
parent d0d9072294
commit ed89322e60

View file

@ -23,6 +23,10 @@ class Alert < ActiveRecord::Base
} }
validates :semester, :presence => true validates :semester, :presence => true
scope :user_alerts, lambda { |user_id|
where('Alerts.user_id = ?', user_id)
}
def alerted? def alerted?
@alerted @alerted
end end
@ -34,8 +38,4 @@ class Alert < ActiveRecord::Base
def sections def sections
end end
def self.user_alerts(user_id)
Alert.where("user_id = #{user_id}")
end
end end