summaryrefslogtreecommitdiff
path: root/lib/api/helpers/users_helpers.rb
blob: 2d7b22e66b35c92892171dbae841af6d64ef810d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# frozen_string_literal: true

module API
  module Helpers
    module UsersHelpers
      extend ActiveSupport::Concern
      extend Grape::API::Helpers

      params :optional_params_ee do
      end

      params :optional_index_params_ee do
      end

      def model_error_messages(model)
        super.tap do |error_messages|
          # Remapping errors from nested associations.
          error_messages[:bio] = error_messages.delete(:"user_detail.bio") if error_messages.has_key?(:"user_detail.bio")
        end
      end
    end
  end
end

API::Helpers::UsersHelpers.prepend_if_ee('EE::API::Helpers::UsersHelpers')