Sha256: 5faf2bd71fcfadce4e7f64f44209f145c3408d4ec6472c590f54f38343ae8d10

Contents?: true

Size: 587 Bytes

Versions: 6

Compression:

Stored size: 587 Bytes

Contents

class PostsController < InheritedResources::Base
  load_and_authorize_resource

  def edit
    @post = Post.find(params[:id])
    render "comments/edit"
  end
  def create
    @post = Post.new(params[:post])
    @post.user =current_user
    if @post.save
      redirect_to(@post.comment.commentable, :notice => 'Post was successfully created.')
    else
      redirect_to :back
      flash[:error]="Completa todos los datos" 
    end
  end
   
  def update
    update!{@post.comment.commentable}
  end

  def destroy
    @post.destroy
    redirect_to @post.comment.commentable
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
squeezer-0.2.1 app/controllers/posts_controller.rb
squeezer-0.2.0 app/controllers/posts_controller.rb
squeezer-0.1.11 app/controllers/posts_controller.rb
squeezer-0.1.7 app/controllers/posts_controller.rb
squeezer-0.1.6 app/controllers/posts_controller.rb
squeezer-0.1.5 app/controllers/posts_controller.rb