from django.contrib import messages
from django.shortcuts import redirect, render
from django.contrib.auth.decorators import login_required
@login_required
class PostsController < ApplicationController
def create
@post = current_user.posts.build(post_params)
if @post.save
flash[:success] = 'Post was successfully created.'