Class: Ems::CategoriesController
- Inherits:
- 
      ApplicationController
      
        - Object
- ActionController::Base
- ApplicationController
- Ems::CategoriesController
 
- Defined in:
- app/controllers/ems/categories_controller.rb
Instance Method Summary collapse
- 
  
    
      #create  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    POST /categories POST /categories.json. 
- 
  
    
      #destroy  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    DELETE /categories/1 DELETE /categories/1.json. 
- 
  
    
      #edit  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    GET /categories/1/edit. 
- 
  
    
      #index  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    GET /categories GET /categories.json. 
- 
  
    
      #new  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    GET /categories/new GET /categories/new.json. 
- 
  
    
      #show  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    GET /categories/1 GET /categories/1.json. 
- 
  
    
      #update  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    PUT /categories/1 PUT /categories/1.json. 
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
POST /categories POST /categories.json
| 44 45 46 47 48 49 50 51 52 53 54 55 56 | # File 'app/controllers/ems/categories_controller.rb', line 44 def create @category = Category.new(params[:category]) respond_to do |format| if @category.save format.html { redirect_to @category, notice: 'Category was successfully created.' } format.json { render json: @category, status: :created, location: @category } else format.html { render action: "new" } format.json { render json: @category.errors, status: :unprocessable_entity } end end end | 
#destroy ⇒ Object
DELETE /categories/1 DELETE /categories/1.json
| 76 77 78 79 80 81 82 83 84 | # File 'app/controllers/ems/categories_controller.rb', line 76 def destroy @category = Category.find(params[:id]) @category.destroy respond_to do |format| format.html { redirect_to categories_url } format.json { head :no_content } end end | 
#edit ⇒ Object
GET /categories/1/edit
| 38 39 40 | # File 'app/controllers/ems/categories_controller.rb', line 38 def edit @category = Category.find(params[:id]) end | 
#index ⇒ Object
GET /categories GET /categories.json
| 6 7 8 9 10 11 12 13 | # File 'app/controllers/ems/categories_controller.rb', line 6 def index @categories = Category.all respond_to do |format| format.html # index.html.erb format.json { render json: @categories } end end | 
#new ⇒ Object
GET /categories/new GET /categories/new.json
| 28 29 30 31 32 33 34 35 | # File 'app/controllers/ems/categories_controller.rb', line 28 def new @category = Category.new respond_to do |format| format.html # new.html.erb format.json { render json: @category } end end | 
#show ⇒ Object
GET /categories/1 GET /categories/1.json
| 17 18 19 20 21 22 23 24 | # File 'app/controllers/ems/categories_controller.rb', line 17 def show @category = Category.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @category } end end | 
#update ⇒ Object
PUT /categories/1 PUT /categories/1.json
| 60 61 62 63 64 65 66 67 68 69 70 71 72 | # File 'app/controllers/ems/categories_controller.rb', line 60 def update @category = Category.find(params[:id]) respond_to do |format| if @category.update_attributes(params[:category]) format.html { redirect_to @category, notice: 'Category was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @category.errors, status: :unprocessable_entity } end end end |