Sha256: 6029baca81884f5efca84b9bd3191ad1068ee685184a4f263960d22e70aa5714

Contents?: true

Size: 530 Bytes

Versions: 5

Compression:

Stored size: 530 Bytes

Contents

class Api::Internal::BlogsController < Api::Internal::BaseController
  def index
    respond_with Blog.all
  end

  def show
    respond_with blog
  end

  def create
    respond_with Blog.create!(blog_params)
  end

  def update
    blog.update!(blog_params)
    respond_with blog
  end

  def destroy
    respond_with blog.destroy!
  end

  private

  def blog
    @blog ||= Blog.find_by!(id: params[:id])
  end

  def blog_params
    params.require(:blog).permit(
      :title,
      :body,
      :portfolio_id
    )
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
power_api-2.1.1 spec/dummy/app/controllers/api/internal/blogs_controller.rb
power_api-2.1.0 spec/dummy/app/controllers/api/internal/blogs_controller.rb
power_api-2.0.2 spec/dummy/app/controllers/api/internal/blogs_controller.rb
power_api-2.0.1 spec/dummy/app/controllers/api/internal/blogs_controller.rb
power_api-2.0.0 spec/dummy/app/controllers/api/internal/blogs_controller.rb