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

Version Path
bard-file_field-0.1.5 dummy/app/controllers/posts_controller.rb
bard-file_field-0.1.4 dummy/app/controllers/posts_controller.rb
bard-file_field-0.1.3 dummy/app/controllers/posts_controller.rb
bard-file_field-0.1.2 dummy/app/controllers/posts_controller.rb
bard-file_field-0.1.1 dummy/app/controllers/posts_controller.rb
bard-file_field-0.1.0 dummy/app/controllers/posts_controller.rb