Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Allow only admin to edit topics

  • Loading branch information...
commit 48787d87753b8f816d523c0510e7f82ea06a3927 1 parent fb63926
Alex Bredariol Grilo authored
View
2  app/controllers/topics_controller.rb
@@ -79,7 +79,7 @@ def show
def edit
@topic = Topic.find_by_slug_or_id(params[:id])
- unless current_user.can_modify?(@topic)
+ unless current_user.admin?
redirect_to @topic
return
end
View
2  app/views/topics/_common.html.haml
@@ -9,7 +9,7 @@
.controls
.actions
- - if logged_in? && current_user.can_modify?(@topic)
+ - if logged_in? && current_user.admin?
= link_to t('scaffold.edit'), edit_topic_path(@topic)
- if @topic.allow_question_lists
.featured
Please sign in to comment.
Something went wrong with that request. Please try again.