Skip to content

Instantly share code, notes, and snippets.

@staycreativedesign
Created July 25, 2017 18:44
Show Gist options
  • Save staycreativedesign/ae79ef010b9029ebf8f9bf5b23c73d20 to your computer and use it in GitHub Desktop.
Save staycreativedesign/ae79ef010b9029ebf8f9bf5b23c73d20 to your computer and use it in GitHub Desktop.
class BusinessCategory < ApplicationRecord
validates_presence_of :name
has_many :jobs
has_many :business_industries, through: :jobs
end
class BusinessIndustry < ActiveRecord::Base
belongs_to :business_category
validates_presence_of :name
has_many :jobs
has_many :business_categories, through: :jobs
end
class Job < ApplicationRecord
belongs_to :user
belongs_to :business_information
belongs_to :business_category
belongs_to :business_industry
end
class User < ApplicationRecord
belongs_to :team
has_secure_password
has_one :membership_payment
has_one :membership_application
has_one :job
accepts_nested_attributes_for :job
validates_presence_of :email
validates_presence_of :phone_number
validates_presence_of :first_name
validates_presence_of :last_name
validates_presence_of :birthday
validates_presence_of :role
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment