Adapts debates controller to new permissions system
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
class DebatesController < ApplicationController
|
||||
include RecaptchaHelper
|
||||
before_action :set_debate, only: [:show, :edit, :update, :vote]
|
||||
before_action :authenticate_user!, except: [:index, :show]
|
||||
before_action :validate_ownership, only: [:edit, :update]
|
||||
load_and_authorize_resource
|
||||
|
||||
def index
|
||||
if params[:tag]
|
||||
@@ -56,10 +54,6 @@ class DebatesController < ApplicationController
|
||||
params.require(:debate).permit(:title, :description, :tag_list, :terms_of_service)
|
||||
end
|
||||
|
||||
def validate_ownership
|
||||
raise ActiveRecord::RecordNotFound unless @debate.editable_by?(current_user)
|
||||
end
|
||||
|
||||
def set_voted_values(debates_ids)
|
||||
@voted_values = current_user ? current_user.votes_on_debates(debates_ids) : {}
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user