class Api::InstitutionsController < ApiController
  
  def information_officer
    institution = Institution.find params[:id]
    unless institution.information_officer.nil?
      respond_to do |format|
        format.json {
          render json: institution.information_officer.attributes, callback: params[:callback]
        }
      end
    end
  end

  def institution_dependences
    @institution_dependences = InstitutionDependence.where(institution_id: params[:id])
    @dependences = {}
    
    @institution_dependences.each do |c|
      @dependences[c.id] = c.name.to_s
    end

    respond_to do |format|
      format.json { render json: @dependences, callback: params[:callback] }
    end
  
  end

end