Sha256: 182a465fae07081b555c72853f6e4ad464fd6dcde6d0b06728e1e1cdb64bb602

Contents?: true

Size: 818 Bytes

Versions: 5

Compression:

Stored size: 818 Bytes

Contents

class ImagePostsController < ApplicationController
  
  def index
    @image_posts = ImagePost.all
  end
  
  def new
    @image_post = ImagePost.new
  end
  
  def create
    @image_post = ImagePost.new(params[:image_post])
    
    if @image_post.save
      redirect_to image_posts_url
    else
      render :action => 'new'
    end
  end
  
  def show
    @image_post = ImagePost.find(params[:id])
  end
  
  def edit
    @image_post = ImagePost.find(params[:id])
  end
  
  def update
    @image_post = ImagePost.find(params[:id])
    
    if @image_post.update_attributes(params[:image_post])
      redirect_to image_posts_url
    else
      render :action => 'edit'
    end
  end
  
  def destroy
    @image_post = ImagePost.find(params[:id])
    @image_post.destroy
    redirect_to image_posts_url
  end
  
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
heritage-0.3.2 heritage_demo/app/controllers/image_posts_controller.rb
heritage-0.3.1 heritage_demo/app/controllers/image_posts_controller.rb
heritage-0.3.0 heritage_demo/app/controllers/image_posts_controller.rb
heritage-0.2.0 heritage_demo/app/controllers/image_posts_controller.rb
heritage-0.1.0 heritage_demo/app/controllers/image_posts_controller.rb