Sha256: b7dc618200a35a96ae9f14eef870b759b6f3ab2b9d561385b94fb95c3a6175bc
Contents?: true
Size: 1.42 KB
Versions: 1
Compression:
Stored size: 1.42 KB
Contents
class SchoolsController < ApplicationController ssl_exceptions authorize_resource 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 def create @school = School.new params[:school] if @school && @school.save render :json => @school.to_client_model_json else render_error end end 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 def edit @school = School.where("id = ?", params[:id]).first render :partial => 'form', :layout => false end private def render_success render :json => { :status => :ok, :html => render_to_string(:partial => 'search') }.to_json end def render_error render :status => 400, :json => { :status => :error, :message => 'Your educational institution could not be saved. Please review the form and verify all required fields are completed', :html => render_to_string(:partial => 'form.html') }.to_json end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
scidea-schools-1.0.0 | app/controllers/schools_controller.rb |