Updated

app/controllers/api/v1/accounts / accounts_controller.rb

A
31 lines of codes
4 methods
3.9 complexity/method
1 churn
15.62 complexity
20 duplications
# frozen_string_literal: true class Api::V1::Accounts::AccountsController < Api::V1::InternalController
  1. Api::V1::Accounts::AccountsController assumes too much for instance variable '@account'
  2. Api::V1::Accounts::AccountsController has no descriptive comment
before_action :set_account, only: %i[show update] def show if @account render json: @account, status: :ok else render json: { errors: 'Not found' }, status: :not_found end end def update if @account.update(account_params)
  1. Similar code found in 2 nodes Locations: 0 1
render json: @account, status: :ok else render json: { errors: @account.errors.full_messages }, status: :unprocessable_entity end end private def set_account @account = Account.find(params['id']) end def account_params params.permit(:name, :number_of_employees, :segment, :site_url, :woofbot_auto_reply) end end