Created
          March 11, 2011 02:03 
        
      - 
      
 - 
        
Save paulelliott/865338 to your computer and use it in GitHub Desktop.  
    Merged create/update actions
  
        
  
    
      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 ComicsController < ApplicationController | |
| respond_to :html | |
| before_filter :authenticated | |
| before_filter :authenticate_admin, except: :index | |
| expose :comic | |
| expose(:comics) do | |
| User.find_by_username(params[:username]).try(:comics) || Comic.all | |
| end | |
| def create | |
| respond_with(comic.tap(&:save)) | |
| end | |
| alias update create | |
| def destroy | |
| comic.destroy | |
| respond_with(comic) | |
| end | |
| end | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment