Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class PostsController < ApplicationController
- def index
- end
- def create
- @post = current_user.posts.build(post_params)
- if @post.save
- flash[:success] = 'Post successful'
- redirect_to posts_path
- else
- flash[:danger] = 'Post unsuccessful'
- render 'users/show'
- end
- end
- def destroy
- end
- private
- def post_params
- params.require(:post).permit(:content)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement