-
-
Save alvadorn/8875d343f5371520d3927ea6dce19817 to your computer and use it in GitHub Desktop.
Lesson halp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ApplicationRecord < ActiveRecord::Base | |
| self.abstract_class = true | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ClassTime < ApplicationRecord | |
| belongs_to :lesson | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Lesson < ApplicationRecord | |
| has_many :students, :through => :sessions | |
| has_many :class_times | |
| validates :name, presence: true, length: {maximum: 256} | |
| validates :number_of_students, presence: true, numericality: { only_integer: true } | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Session < ApplicationRecord | |
| belongs_to :student | |
| belongs_to :lesson | |
| end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Student < ApplicationRecord | |
| #attr_accessor :name, :registration, :address, :phone_number, :last_payment | |
| has_many :lessons, :through => :session | |
| validates :name, presence: true, length: {maximum: 256} | |
| validates :registration, presence: true, length: {maximum: 12} | |
| validates :address, presence: true, length: {maximum: 256} | |
| validates :phone_number, presence: true, length: {maximum: 256} | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment