Class: Guts::CategoriesController
- Inherits:
 - 
      ApplicationController
      
        
- Object
 - ActionController::Base
 - ApplicationController
 - Guts::CategoriesController
 
 
- Includes:
 - ControllerPermissionConcern
 
- Defined in:
 - app/controllers/guts/categories_controller.rb
 
Overview
Categories controller
Instance Method Summary collapse
- 
  
    
      #create  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Creates a category through post.
 - 
  
    
      #destroy  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Destroys a category.
 - 
  
    
      #edit  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Editing for a category.
 - 
  
    
      #index  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Displays a list of categories.
 - 
  
    
      #new  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Creation of a new category.
 - 
  
    
      #show  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Shows details about a single category.
 - 
  
    
      #update  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Updates a category through patch.
 
Methods inherited from ApplicationController
Methods included from MultisiteConcern
#current_site, #with_current_site
Instance Method Details
#create ⇒ Object
    Note:
    
  
Redirects to #index if successfull or re-renders #new if not
Creates a category through post
      31 32 33 34 35 36 37 38 39 40  | 
    
      # File 'app/controllers/guts/categories_controller.rb', line 31 def create @category = Category.new category_params if @category.save flash[:notice] = 'Category was successfully created.' redirect_to edit_category_path(@category) else render :new end end  | 
  
#destroy ⇒ Object
    Note:
    
  
Redirects to #index on success
Destroys a category
      55 56 57 58 59 60  | 
    
      # File 'app/controllers/guts/categories_controller.rb', line 55 def destroy @category.destroy flash[:notice] = 'Category was successfully destroyed.' redirect_to categories_path end  | 
  
#edit ⇒ Object
Editing for a category
      26 27  | 
    
      # File 'app/controllers/guts/categories_controller.rb', line 26 def edit end  | 
  
#index ⇒ Object
Displays a list of categories
      12 13 14  | 
    
      # File 'app/controllers/guts/categories_controller.rb', line 12 def index @categories = Category.all end  | 
  
#new ⇒ Object
Creation of a new category
      21 22 23  | 
    
      # File 'app/controllers/guts/categories_controller.rb', line 21 def new @category = Category.new end  | 
  
#show ⇒ Object
Shows details about a single category
      17 18  | 
    
      # File 'app/controllers/guts/categories_controller.rb', line 17 def show end  | 
  
#update ⇒ Object
    Note:
    
  
Redirects to #index if successfull or re-renders #edit if not
Updates a category through patch
      44 45 46 47 48 49 50 51  | 
    
      # File 'app/controllers/guts/categories_controller.rb', line 44 def update if @category.update category_params flash[:notice] = 'Category was successfully updated.' redirect_to edit_category_path(@category) else render :edit end end  |