Created
August 13, 2017 15:47
-
-
Save RachelSa/910d868ca7180fcbb94e1367be0912da to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ClassroomsController < ApplicationController | |
def update | |
@classroom = Classroom.find(params[:id]) | |
if @classroom.update(classroom_params) | |
redirect_to users_path, :notice => "#{@classroom.name} updated" | |
else | |
flash[:notice] = "Classrooms must have a name" | |
@programs = Program.all | |
render :edit | |
end | |
end | |
private | |
def classroom_params | |
params.require(:classroom).permit(:name, :location, :map_url, :image_url, :description, :longitude, :latitude, :google_address, :phone, {:program_ids => []}) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment