Sha256: 637d7526c6499bfaa5ad574d773744ffbe353a232254fdc1e5e24037860c9d8a

Contents?: true

Size: 816 Bytes

Versions: 9

Compression:

Stored size: 816 Bytes

Contents

module PostsController
  class Index < ApplicationController
    expose(:posts) { Post.all }
  end

  class New < ApplicationController
    expose(:post) { Post.new params[:post] }
  end

  class Create < New
    def call
      if post.save
        redirect_to post, :notice => 'Post was successfully created.'
      else
        render :action => "new"
      end
    end
  end

  class Show < ApplicationController
    expose(:post) { Post.find params[:id] }
  end

  class Edit < Show
  end

  class Update < Edit
    def call
      if post.update_attributes(params[:post])
        redirect_to post, :notice => 'Post was successfully updated.'
      else
        render :action => "edit"
      end
    end
  end

  class Destroy < Edit
    def call
      post.destroy
      redirect_to posts_url
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
focused_controller-2.0.3 test/app/app/controllers/posts_controller.rb
focused_controller-2.0.2 test/app/app/controllers/posts_controller.rb
focused_controller-2.0.1 test/app/app/controllers/posts_controller.rb
focused_controller-2.0.0 test/app/app/controllers/posts_controller.rb
focused_controller-1.2.1 test/app/app/controllers/posts_controller.rb
focused_controller-1.2.0 test/app/app/controllers/posts_controller.rb
focused_controller-1.1.1 test/app/app/controllers/posts_controller.rb
focused_controller-1.1.0 test/app/app/controllers/posts_controller.rb
focused_controller-1.0.0 test/app/app/controllers/posts_controller.rb