Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Normalize question values

  • Loading branch information...
commit ab6545715b969bd9d09025ee42547edb17a66e29 1 parent 2ac4517
@rwdaigle authored
Showing with 6 additions and 0 deletions.
  1. +6 −0 app/models/unit.rb
View
6 app/models/unit.rb
@@ -4,6 +4,8 @@ class Unit < ActiveRecord::Base
validates_presence_of :question, :subject
validates_uniqueness_of :question, :scope => :subject_id
+
+ before_save :normalize_question
belongs_to :subject
has_many :learnings, :dependent => :delete_all
@@ -64,4 +66,8 @@ def process!(overwrite = false)
def to_log
{ unit_id: self.id, unit: question }
end
+
+ def normalize_question
+ self.question = question.strip.downcase if question
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.