Use scope for user_alerts to make it more 'railsy'
This commit is contained in:
parent
d0d9072294
commit
ed89322e60
1 changed files with 4 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue