Created
          May 24, 2011 18:03 
        
      - 
      
 - 
        
Save marcelloma/989266 to your computer and use it in GitHub Desktop.  
    decent_exposure + meta_search + cancan
  
        
  
    
      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 characters
    
  
  
    
  | 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 | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment