Class: Api::PeopleController
- Inherits:
- 
      ApiController
      
        - Object
- ApiController
- Api::PeopleController
 
- Defined in:
- app/controllers/api/people_controller.rb
Overview
temporarily filled out but not used yet (just AggregatedController used) will have to figure out how to pass the json parameters to this controller
Instance Method Summary (collapse)
- 
  
    
      - (Object) create 
    
    
  
  
  
  
  
  
  
  
  
    creates a new person parameters from JSON: name, position, institution currently assumes that all parameters are not nil only checks if the name exists in the database not sure if we should render as json. 
- - (Object) destroy
- - (Object) edit
- - (Object) index
- - (Object) new
- - (Object) show
- - (Object) update
Instance Method Details
- (Object) create
creates a new person parameters from JSON: name, position, institution currently assumes that all parameters are not nil only checks if the name exists in the database not sure if we should render as json
| 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | # File 'app/controllers/api/people_controller.rb', line 30 def create Rails.logger.info(params) # check if all the criterias are filled # first I just continue to create iff name, positionl, institution exists if params.has_key?(:name) && params.has_key?(:position) && params.has_key?(:institution) # check if the person already exists? The person might exists as a mentor of other maybe unless Person.exists?(name: params[:name]) @person = Person.new_person(params[:name], params[:position], params[:institution]) if @person != nil && @person.save render json: @person.as_json, status: :created return end else render json: {error: 'person exists'}, status: :bad_request end end #render json: {warning: 'not implemented'}, status: 200 end | 
- (Object) destroy
| 53 54 55 | # File 'app/controllers/api/people_controller.rb', line 53 def destroy render json: {warning: 'not implemented'}, status: 200 end | 
- (Object) edit
| 20 21 22 23 | # File 'app/controllers/api/people_controller.rb', line 20 def edit # differences between edit and update? render json: {warning: 'not implemented'}, status: 200 end | 
- (Object) index
| 7 8 9 | # File 'app/controllers/api/people_controller.rb', line 7 def index render json: {warning: 'not implemented'}, status: 200 end | 
- (Object) new
| 15 16 17 18 | # File 'app/controllers/api/people_controller.rb', line 15 def new # differences between new and create? render json: {warning: 'not implemented'}, status: 200 end | 
- (Object) show
| 11 12 13 | # File 'app/controllers/api/people_controller.rb', line 11 def show render json: {warning: 'not implemented'}, status: 200 end | 
- (Object) update
| 49 50 51 | # File 'app/controllers/api/people_controller.rb', line 49 def update render json: {warning: 'not implemented'}, status: 200 end |