Class: Blabs::PublishedBlogPostsController
Instance Method Summary
collapse
#blabs_admin_required, #blabs_current_user_name, #check_is_admin, #pretty_blog_post_path, #pretty_blog_post_url
Instance Method Details
#create ⇒ Object
4
5
6
7
8
9
10
11
12
|
# File 'app/controllers/blabs/published_blog_posts_controller.rb', line 4
def create
find_blog_post
if @blog_post.publish!
flash[:notice] = "Blog post published successfully!"
else
flash[:error] = "Couldn't publish this blog post"
end
redirect_to pretty_blog_post_path(@blog_post)
end
|
#destroy ⇒ Object
14
15
16
17
18
19
20
21
22
|
# File 'app/controllers/blabs/published_blog_posts_controller.rb', line 14
def destroy
find_blog_post
if @blog_post.unpublish!
flash[:notice] = "Blog post unpublished successfully!"
else
flash[:error] = "Couldn't unpublish this blog post"
end
redirect_to pretty_blog_post_path(@blog_post)
end
|