app/controllers/phcpress/blog/posts_controller.rb in phcpress-2.8.7 vs app/controllers/phcpress/blog/posts_controller.rb in phcpress-2.8.8
- old
+ new
@@ -26,18 +26,17 @@
# Edit Blog Post (/blog/posts/1/edit)
def edit
end
- # POST
+ # Create News Post /news/posts/new
def create
- @blog_post.user_id = current_user
- @blog_post = Blog::Post.new(blog_post_params)
-
- if @blog_post.save
+ @blog_post = Blog::Post.(blog_post_params)
+ @blog_post.user_id = current_user.id
+ if @blog_post.save
redirect_to blog_posts_path, notice: 'Blog post was successfully created.'
- else
- render :new
+ else
+ render 'new'
end
end
# PATCH/PUT
def update