Created
May 24, 2011 18:03
Revisions
-
Marcello Milhomem Albuquerque created this gist
May 24, 2011 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ class SectionsController < ApplicationController load_and_authorize_resource expose(:section) expose(:sections) { search.paginate(:page => params[:page]) } expose(:search) { Section.search(params[:search]) } def create if section.save redirect_to(sections_url, :notice => t(:create_success, :model => t_model(:section))) else render :action => "new" end end def update if section.update_attributes(params[:section]) redirect_to(sections_url, :notice => t(:update_success, :model => t_model(:section))) else render :action => "edit" end end def destroy section.destroy redirect_to(sections_url, :notice => t(:delete_success, :model => t_model(:section))) end end