Sha256: 0fb93976e894e2d1bdf947bae60841f1d94200c3a4983d738bedad27377bf76b

Contents?: true

Size: 736 Bytes

Versions: 2

Compression:

Stored size: 736 Bytes

Contents

class Student < ActiveRecord::Base
  has_and_belongs_to_many :subjects
  has_many :grades
  has_many :parents
  
  def report_card
    subjects.map do |subject|
      grade = grades.find_by_subject_id(subject.id)
      "#{subject.name}: #{grade.value if grade}"
    end
  end
end

class Parent < ActiveRecord::Base
  belongs_to :student
end

class Location < ActiveRecord::Base
  validates :slug, format: {with: /\A[a-z0-9\-]+\z/}
end

class Subject < ActiveRecord::Base
  has_and_belongs_to_many :students
end

class Grade < ActiveRecord::Base
  belongs_to :student
  belongs_to :subject
end

class Account < ActiveRecord::Base
  has_many :parents
  has_many :students
  has_many :subjects
  has_many :grades
  has_many :locations
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
abstract_importer-1.1.0 test/support/mock_objects.rb
abstract_importer-1.0.0 test/support/mock_objects.rb