Class: Api::SupervisionsController
- Inherits:
-
ApiController
- Object
- ApiController
- Api::SupervisionsController
- Defined in:
- app/controllers/api/supervisions_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 supervisions relationship parameters from JSON: year, type, institution, supervisor, name currently assumes that all parameters are not nil there are a lot of redundancies with the model that can be removed later 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 supervisions relationship parameters from JSON: year, type, institution, supervisor, name currently assumes that all parameters are not nil there are a lot of redundancies with the model that can be removed later not sure if we should render as json
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'app/controllers/api/supervisions_controller.rb', line 28 def create Rails.logger.info(params) if params.has_key?(:year) && params.has_key(:type) && params.has_key(:institution) && params.has_key(:supervisor) && params.has_key(:name) # need to find the degree, person, and supervisor IDs first degree_id = Degree.find_degree_id(params[:year], params[:type], params[:institution]) name_id = Person.find_person_id(params[:name]) supervisor_id = Person.find_mentor_supervisor_id(params[:supervisor], params[:institution]) # check if the supervisor relationship already exists unless Supervision.exists?(:degree_id => degree_id, :person_id => name_id, :supervisor_id => supervisor_id) @supervision = Supervision.new_degree(params[:year], params[:type], params[:institution], params[:name], params[:supervisor]) if @supervision != nil && @supervision.save render json: @supervision.as_json, status: :created return end end # hmm then I can't add to mentor table, I gotta add to people table # seems like I could instead just call method from person model or people controller #render json: {warning: 'not implemented'}, status: 200 # i don't understand how many times you guys can not close your if statments -- steve end end |
- (Object) destroy
54 55 56 |
# File 'app/controllers/api/supervisions_controller.rb', line 54 def destroy render json: {warning: 'not implemented'}, status: 200 end |
- (Object) edit
19 20 21 |
# File 'app/controllers/api/supervisions_controller.rb', line 19 def edit render json: {warning: 'not implemented'}, status: 200 end |
- (Object) index
7 8 9 |
# File 'app/controllers/api/supervisions_controller.rb', line 7 def index render json: {warning: 'not implemented'}, status: 200 end |
- (Object) new
15 16 17 |
# File 'app/controllers/api/supervisions_controller.rb', line 15 def new render json: {warning: 'not implemented'}, status: 200 end |
- (Object) show
11 12 13 |
# File 'app/controllers/api/supervisions_controller.rb', line 11 def show render json: {warning: 'not implemented'}, status: 200 end |
- (Object) update
50 51 52 |
# File 'app/controllers/api/supervisions_controller.rb', line 50 def update render json: {warning: 'not implemented'}, status: 200 end |