1 class BalloonsController < ApplicationController
2 before_filter :authenticate_user!, :except => [:index]
6 @balloons = Balloon.all
9 format.html # index.html.erb
10 format.json { render json: @balloons }
16 # GET /balloons/1.json
18 @balloon = Balloon.find(params[:id])
20 respond_to do |format|
21 format.html # show.html.erb
22 format.json { render json: @balloon }
27 # GET /balloons/new.json
29 @balloon = Balloon.new
31 respond_to do |format|
32 format.html # new.html.erb
33 format.json { render json: @balloon }
37 # GET /balloons/1/edit
39 @balloon = Balloon.find(params[:id])
45 @balloon = Balloon.new(params[:balloon])
47 respond_to do |format|
49 format.html { redirect_to @balloon, notice: 'Balloon was successfully created.' }
50 format.json { render json: @balloon, status: :created, location: @balloon }
52 format.html { render action: "new" }
53 format.json { render json: @balloon.errors, status: :unprocessable_entity }
59 # PUT /balloons/1.json
61 @balloon = Balloon.find(params[:id])
63 respond_to do |format|
64 if @balloon.update_attributes(params[:balloon])
65 format.html { redirect_to @balloon, notice: 'Balloon was successfully updated.' }
66 format.json { head :ok }
68 format.html { render action: "edit" }
69 format.json { render json: @balloon.errors, status: :unprocessable_entity }
75 # DELETE /balloons/1.json
77 @balloon = Balloon.find(params[:id])
80 respond_to do |format|
81 format.html { redirect_to balloons_url }
82 format.json { head :ok }