🚨Fix Rubocop lint errors
This commit is contained in:
@@ -18,17 +18,15 @@ class ApplicationController < ActionController::Base
|
||||
end
|
||||
|
||||
def handle_with_exception
|
||||
begin
|
||||
yield
|
||||
rescue ActiveRecord::RecordNotFound => exception
|
||||
Raven.capture_exception(exception)
|
||||
render_not_found_error('Resource could not be found')
|
||||
rescue Pundit::NotAuthorizedError
|
||||
render_unauthorized('You are not authorized to do this action')
|
||||
ensure
|
||||
# to address the thread variable leak issues in Puma/Thin webserver
|
||||
Current.user = nil
|
||||
end
|
||||
yield
|
||||
rescue ActiveRecord::RecordNotFound => e
|
||||
Raven.capture_exception(e)
|
||||
render_not_found_error('Resource could not be found')
|
||||
rescue Pundit::NotAuthorizedError
|
||||
render_unauthorized('You are not authorized to do this action')
|
||||
ensure
|
||||
# to address the thread variable leak issues in Puma/Thin webserver
|
||||
Current.user = nil
|
||||
end
|
||||
|
||||
def set_current_user
|
||||
@@ -57,8 +55,8 @@ class ApplicationController < ActionController::Base
|
||||
end
|
||||
|
||||
def render_record_invalid(exception)
|
||||
render json: {
|
||||
message: exception.record.errors.full_messages.join(", ")
|
||||
render json: {
|
||||
message: exception.record.errors.full_messages.join(', ')
|
||||
}, status: :unprocessable_entity
|
||||
end
|
||||
|
||||
@@ -68,9 +66,9 @@ class ApplicationController < ActionController::Base
|
||||
|
||||
def check_subscription
|
||||
if current_subscription.trial? && current_subscription.expiry < Date.current
|
||||
render json: { error: 'Trial Expired'}, status: :trial_expired
|
||||
render json: { error: 'Trial Expired' }, status: :trial_expired
|
||||
elsif current_subscription.cancelled?
|
||||
render json: { error: 'Account Suspended'}, status: :account_suspended
|
||||
render json: { error: 'Account Suspended' }, status: :account_suspended
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user