Class: Degree
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Degree
- Defined in:
- app/models/degree.rb
Overview
Model for handling degrees
Class Method Summary (collapse)
-
+ (Hash{String => String, Number}) new_degree(year, degree_type, institution_name)
Creates a new degree.
Instance Method Summary (collapse)
-
- (Object) as_json(options = {})
Handles rendering a degree in a JSON format.
Class Method Details
+ (Hash{String => String, Number}) new_degree(year, degree_type, institution_name)
Creates a new degree
15 16 17 18 19 20 21 22 23 24 |
# File 'app/models/degree.rb', line 15 def Degree.new_degree(year, degree_type, institution_name) degree_type = degree_type.downcase institution_id = FindId.institution(institution_name) degree = Degree.create_with(approved: false) .find_or_create_by(year: year, degree_type: degree_type, institution_id: institution_id) return degree end |
Instance Method Details
- (Object) as_json(options = {})
Handles rendering a degree in a JSON format.
27 28 29 |
# File 'app/models/degree.rb', line 27 def as_json(={}) super(:except => [:created_at, :updated_at]) end |