From f79bb3eddcd70c6b7360679d8dd29e28147de262 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Fri, 12 Apr 2013 13:12:29 -0400 Subject: [PATCH] Update model to allow for serialized sections --- app/models/alert.rb | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/app/models/alert.rb b/app/models/alert.rb index aff04bf..e88edd4 100644 --- a/app/models/alert.rb +++ b/app/models/alert.rb @@ -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