POST /locations POST /locations.json
# File app/controllers/locations_controller.rb, line 42 def create @location = Location.new(params[:location]) respond_to do |format| if @location.save format.html { redirect_to @location, :notice => 'Location was successfully created.' } format.json { render :json => @location, :status => :created, :location => @location } else format.html { render :action => "new" } format.json { render :json => @location.errors, :status => :unprocessable_entity } end end end
DELETE /locations/1 DELETE /locations/1.json
# File app/controllers/locations_controller.rb, line 74 def destroy @location = Location.find(params[:id]) @location.destroy respond_to do |format| format.html { redirect_to locations_url } format.json { head :ok } end end
GET /locations/1/edit
# File app/controllers/locations_controller.rb, line 36 def edit @location = Location.find(params[:id]) end
GET /locations GET /locations.json
# File app/controllers/locations_controller.rb, line 4 def index @locations = Location.all.sort!{ |o1, o2| o1.room.name <=> o2.room.name } respond_to do |format| format.html # index.html.erb format.json { render :json => @locations } end end
GET /locations/new GET /locations/new.json
# File app/controllers/locations_controller.rb, line 26 def new @location = Location.new respond_to do |format| format.html # new.html.erb format.json { render :json => @location } end end
GET /locations/1 GET /locations/1.json
# File app/controllers/locations_controller.rb, line 15 def show @location = Location.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render :json => @location } end end
PUT /locations/1 PUT /locations/1.json
# File app/controllers/locations_controller.rb, line 58 def update @location = Location.find(params[:id]) respond_to do |format| if @location.update_attributes(params[:location]) format.html { redirect_to @location, :notice => 'Location was successfully updated.' } format.json { head :ok } else format.html { render :action => "edit" } format.json { render :json => @location.errors, :status => :unprocessable_entity } end end end