1
0
Fork 0

Update model to allow for serialized sections

This commit is contained in:
Andrew Tomaka 2013-04-12 13:12:29 -04:00
parent 8c05bfd523
commit f79bb3eddc
1 changed files with 2 additions and 11 deletions

View File

@ -1,5 +1,5 @@
class Alert < ActiveRecord::Base
attr_accessible :course, :department, :semester
attr_accessible :course, :department, :semester, :sections
attr_protected :user_id
attr_protected :alerted
@ -19,14 +19,9 @@ class Alert < ActiveRecord::Base
:format => {
:with => /\A[0-9]+[A-Za-z]?\Z/
}
# validates :user_id, :presence => true,
# :numericality => {
# only_integer: true
# }
validates :semester, :presence => true
validates :sections, :presence => true
serialize :sections
serialize :sections, Array
scope :user_alerts, lambda { |user_id|
where('Alerts.user_id = ?', user_id)
@ -39,8 +34,4 @@ class Alert < ActiveRecord::Base
def course_name
"#{self.department} #{self.course}"
end
def sections
end
end