Add subscription controller

This commit is contained in:
Maximilian Grundke
2017-09-06 16:18:44 +02:00
parent 5aa9edb209
commit f77c7410e1
2 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1,20 @@
class SubscriptionController < ApplicationController
def authorize!
authorize(@submission || @submissions)
end
private :authorize!
def set_subscription
@subscription = Subscription.find(params[:id])
authorize!
end
private :set_subscription
def subscription_params
current_user_id = current_user.try(:id)
current_user_class_name = current_user.try(:class).try(:name)
params[:subscription].permit(:request_for_comment, :type).merge(user_id: current_user_id, user_type: current_user_class_name)
end
private :subscription_params
end

View File

@ -0,0 +1,7 @@
require 'test_helper'
class SubscriptionControllerTest < ActionController::TestCase
# test "the truth" do
# assert true
# end
end