Sha256: e6967ae89b6e3eb65dd21d37cdb5239c8e60af4ffd7f8f0c945f22fd18b2db33
Contents?: true
Size: 536 Bytes
Versions: 6
Compression:
Stored size: 536 Bytes
Contents
class PostsController < ApplicationController def new @post = Post.new render :form end def create @post = Post.create!(post_params) redirect_to @post, notice: "Post created!" end def show @post = Post.find(params[:id]) end def edit @post = Post.find(params[:id]) render :form end def update @post = Post.find(params[:id]) @post.update!(post_params) redirect_to @post, notice: "Post updated!" end private def post_params params.require(:post).permit! end end
Version data entries
6 entries across 6 versions & 1 rubygems