Sha256: e92c30b74ab6b51cec4361cf3ade338edb92d7da18de673f09d05338cc9a566e
Contents?: true
Size: 1.44 KB
Versions: 1
Compression:
Stored size: 1.44 KB
Contents
module Kublog class PostsController < ApplicationController skip_filter :require_admin, :only => [:index, :show] def index @presenter = PostsPresenter.new respond_to do |format| format.atom { render :layout => false } format.rss { redirect_to posts_path(:format => :atom), :status => :moved_permanently } format.html { } end end def new @post = Post.new end def show post = Post.find(params[:id]) @presenter = PostPresenter.new(post) end #TODO: Figure out a proxy method to access User def create @post = current_user.posts.build(params[:post]) if @post.save redirect_to @post else render 'new' end end def edit @post = Post.find(params[:id]) end def update @post = Post.find(params[:id]) if @post.update_attributes(params[:post]) redirect_to @post else render 'edit' end end def destroy @post = Post.find(params[:id]) @post.destroy redirect_to posts_path end def check @post = current_user.posts.build(params[:post]) respond_to do |format| if @post.valid? format.json { render :json => @post } else format.json { render :json => @post.errors.messages, :status => :unprocessable_entity } end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
kublog-0.0.1.1 | app/controllers/kublog/posts_controller.rb |