Class: Institution
- Inherits:
- 
      ActiveRecord::Base
      
        - Object
- ActiveRecord::Base
- Institution
 
- Defined in:
- app/models/institution.rb
Overview
Model for handling institutions
Class Method Summary (collapse)
- 
  
    
      + (Hash{String => String, Number}) new_institution(name) 
    
    
  
  
  
  
  
  
  
  
  
    Creates a new institution. 
Instance Method Summary (collapse)
- 
  
    
      - (Object) as_json(options = {}) 
    
    
  
  
  
  
  
  
  
  
  
    Handles rendering an institution in a JSON format. 
Class Method Details
+ (Hash{String => String, Number}) new_institution(name)
Creates a new institution
| 10 11 12 13 14 15 16 | # File 'app/models/institution.rb', line 10 def Institution.new_institution(name) name = name.downcase institution = Institution.create_with(approved: false) .find_or_create_by(name: name) return institution end | 
Instance Method Details
- (Object) as_json(options = {})
Handles rendering an institution in a JSON format.
| 19 20 21 | # File 'app/models/institution.rb', line 19 def as_json(={}) super(:except => [:created_at, :updated_at, :approved]) end |