Skip to content

Instantly share code, notes, and snippets.

@marcelloma
Created May 25, 2011 15:55
Show Gist options
  • Save marcelloma/991230 to your computer and use it in GitHub Desktop.
Save marcelloma/991230 to your computer and use it in GitHub Desktop.
floors controller
class FloorsController < ApplicationController
load_and_authorize_resource
expose(:floor)
expose(:floors) { search.paginate(:page => params[:page]) }
expose(:search) { Floor.search(params[:search]) }
def create
if floor.save
redirect_to(floors_url, :notice => t(:create_success, :model => t_model(:floor)))
else
render :action => "new"
end
end
def update
if floor.update_attributes(params[:floor])
redirect_to(floors_url, :notice => t(:update_success, :model => t_model(:floor)))
else
render :action => "edit"
end
end
def destroy
floor.destroy
redirect_to(floors_url, :notice => t(:delete_success, :model => t_model(:floor)))
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment