Add post list

This commit is contained in:
riggraz
2019-09-02 19:26:34 +02:00
parent edacfb1a4f
commit 86286b634d
13 changed files with 251 additions and 74 deletions

View File

@@ -1,5 +1,16 @@
class PostsController < ApplicationController
before_action :authenticate_user!
# before_action :authenticate_user!
def index_by_board_id
board_id = params[:board_id] || 1
posts = Post
.left_outer_joins(:post_status)
.select('posts.title, posts.description, post_statuses.name as post_status_name, post_statuses.color as post_status_color')
.where(board_id: board_id)
render json: posts
end
def create
post = Post.new(post_params)