mirror of
https://github.com/ditkrg/rswag.git
synced 2026-01-23 22:36:42 +00:00
24 lines
436 B
Ruby
24 lines
436 B
Ruby
class BlogsController < ApplicationController
|
|
wrap_parameters Blog
|
|
respond_to :json
|
|
|
|
# POST /blogs
|
|
def create
|
|
@blog = Blog.create(params[:blog])
|
|
respond_with @blog
|
|
end
|
|
|
|
# GET /blogs
|
|
def index
|
|
@blogs = Blog.all
|
|
respond_with @blogs
|
|
end
|
|
|
|
# GET /blogs/1
|
|
def show
|
|
@blog = Blog.find_by_id(params[:id])
|
|
respond_with @blog, status: :not_found and return unless @blog
|
|
respond_with @blog
|
|
end
|
|
end
|