Skip to content

Instantly share code, notes, and snippets.

@DougHall
Created October 11, 2012 19:55
Show Gist options
  • Save DougHall/3875089 to your computer and use it in GitHub Desktop.
Save DougHall/3875089 to your computer and use it in GitHub Desktop.
ScoreSession model
class ScoreSession < ActiveRecord::Base
belongs_to :assessor, :class_name => "User"
has_many :station_scores, :dependent => :destroy
has_many :trainees, :through => :station_scores
attr_accessor :cluster, :line
validates_presence_of :cluster, :line
accepts_nested_attributes_for :station_scores, :reject_if => :all_blank
def cluster_val
self.cluster.split('..').inject { |s,e| s.to_i..e.to_i }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment