Sha256: a7437a51b40a6dcdca760faeb19bdab2c76675ed88187cd37c1e3ba144119804
Contents?: true
Size: 774 Bytes
Versions: 6
Compression:
Stored size: 774 Bytes
Contents
class NormalPostsController < ApplicationController def index @posts = Post.all end def show @post = Post.find(params[:id]) end def new @post = Post.new end def edit @post = Post.find(params[:id]) end def create @post = Post.new(post_params) if @post.save redirect_to [:normal, @post] else render :new end end def update @post = Post.find(params[:id]) if @post.update_attributes(post_params) redirect_to [:normal, @post] else render :edit end end def destroy Post.find(params[:id]).destroy redirect_to :normal_posts end private def post_params params.require(:post).permit(:title, :image, :document, :remove_document, :remote_document_url) end end
Version data entries
6 entries across 6 versions & 1 rubygems