1 class RentableController < ApplicationController
3 # Make sure that a user logs in before doing any action here
4 before_filter :authorize
8 render :action => 'list'
11 # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
12 verify :method => :post, :only => [ :destroy, :create, :update ],
13 :redirect_to => { :action => :list }
16 @rentable_pages, @rentables = paginate :rentables, :per_page => 10
20 @rentable = Rentable.find(params[:id])
24 @rentable = Rentable.new
28 @rentable = Rentable.new(params[:rentable])
30 flash[:notice] = 'Rentable was successfully created.'
31 redirect_to :action => 'list'
33 render :action => 'new'
38 @rentable = Rentable.find(params[:id])
42 @rentable = Rentable.find(params[:id])
43 if @rentable.update_attributes(params[:rentable])
44 flash[:notice] = 'Rentable was successfully updated.'
45 redirect_to :action => 'show', :id => @rentable
47 render :action => 'edit'
52 Rentable.find(params[:id]).destroy
53 redirect_to :action => 'list'