class RoomsController

Public Instance Methods

create() click to toggle source

POST /rooms POST /rooms.json

# File app/controllers/rooms_controller.rb, line 43
def create
  @room = Room.new(params[:room])

  respond_to do |format|
    if @room.save
      format.html { redirect_to @room, :notice => 'Room was successfully created.' }
      format.json { render :json => @room, :status => :created, :location => @room }
    else
      format.html { render :action => "new" }
      format.json { render :json => @room.errors, :status => :unprocessable_entity }
    end
  end
end
destroy() click to toggle source

DELETE /rooms/1 DELETE /rooms/1.json

# File app/controllers/rooms_controller.rb, line 75
def destroy
  @room = Room.find(params[:id])
  @room.destroy

  respond_to do |format|
    format.html { redirect_to rooms_url }
    format.json { head :ok }
  end
end
edit() click to toggle source

GET /rooms/1/edit

# File app/controllers/rooms_controller.rb, line 37
def edit
  @room = Room.find(params[:id])
end
index() click to toggle source

GET /rooms GET /rooms.json

# File app/controllers/rooms_controller.rb, line 4
def index
  @rooms = Room.all
  @locations = Location.all

  respond_to do |format|
    format.html # index.html.erb
    format.json { render :json => @rooms }
  end
end
new() click to toggle source

GET /rooms/new GET /rooms/new.json

# File app/controllers/rooms_controller.rb, line 27
def new
  @room = Room.new

  respond_to do |format|
    format.html # new.html.erb
    format.json { render :json => @room }
  end
end
show() click to toggle source

GET /rooms/1 GET /rooms/1.json

# File app/controllers/rooms_controller.rb, line 16
def show
  @room = Room.find(params[:id])

  respond_to do |format|
    format.html # show.html.erb
    format.json { render :json => @room }
  end
end
update() click to toggle source

PUT /rooms/1 PUT /rooms/1.json

# File app/controllers/rooms_controller.rb, line 59
def update
  @room = Room.find(params[:id])

  respond_to do |format|
    if @room.update_attributes(params[:room])
      format.html { redirect_to @room, :notice => 'Room was successfully updated.' }
      format.json { head :ok }
    else
      format.html { render :action => "edit" }
      format.json { render :json => @room.errors, :status => :unprocessable_entity }
    end
  end
end