Class: SchoolsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- SchoolsController
- Defined in:
- app/controllers/schools_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/controllers/schools_controller.rb', line 13 def create @school = School.new params[:school] @school.approved = current_user && current_user.is_admin? if @school && @school.save render :json => @school.to_client_model_json else render_error end end |
#edit ⇒ Object
38 39 40 41 42 |
# File 'app/controllers/schools_controller.rb', line 38 def edit @school = School.where("id = ?", params[:id]).first render :partial => 'form', :layout => false end |
#index ⇒ Object
6 7 8 9 10 11 |
# File 'app/controllers/schools_controller.rb', line 6 def index @selected_school = params[:new_school_id] ? School.where("id = ?", params[:new_school_id]).first : nil @schools = School.learner_form_search(params[:zipcode], @selected_school) render_success end |
#update ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/controllers/schools_controller.rb', line 25 def update @school = School.where("id = ?", params[:id]).first if @school && @school.update_attributes(params[:school]) # @schools = School.learner_form_search(@school.zipcode, @school) # @selected_school = @school render :json => @school.to_client_model_json # render_success else render_error end end |