Chore: Code Cleanup in API controllers (#932)

* Chore: Code Cleanup in API controllers

* Remove unnecessary scoping for accounts controller
This commit is contained in:
Sojan Jose
2020-06-07 13:58:05 +05:30
committed by GitHub
parent 3d84568a37
commit 051871a3cd
35 changed files with 176 additions and 182 deletions

View File

@@ -1,16 +1,16 @@
class Api::V1::Accounts::LabelsController < Api::BaseController
class Api::V1::Accounts::LabelsController < Api::V1::Accounts::BaseController
before_action :current_account
before_action :fetch_label, except: [:index, :create]
before_action :check_authorization
def index
@labels = policy_scope(current_account.labels)
@labels = policy_scope(Current.account.labels)
end
def show; end
def create
@label = current_account.labels.create!(permitted_params)
@label = Current.account.labels.create!(permitted_params)
end
def update
@@ -25,7 +25,7 @@ class Api::V1::Accounts::LabelsController < Api::BaseController
private
def fetch_label
@label = current_account.labels.find(params[:id])
@label = Current.account.labels.find(params[:id])
end
def check_authorization