Module: API::Helpers::UsersHelpers
- Extended by:
- ActiveSupport::Concern, Grape::API::Helpers
- Defined in:
- lib/api/helpers/users_helpers.rb
Instance Method Summary collapse
-
#find_user_by_id(params) ⇒ Object
rubocop: disable CodeReuse/ActiveRecord.
- #model_errors(model) ⇒ Object
Instance Method Details
#find_user_by_id(params) ⇒ Object
rubocop: disable CodeReuse/ActiveRecord
27 28 29 30 |
# File 'lib/api/helpers/users_helpers.rb', line 27 def find_user_by_id(params) id = params[:user_id] || params[:id] User.find_by(id: id) || not_found!('User') end |
#model_errors(model) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/api/helpers/users_helpers.rb', line 15 def model_errors(model) super.tap do |errors| # Remapping errors from nested associations. next unless errors.has_key?(:"user_detail.bio") errors.delete(:"user_detail.bio").each do || errors.add(:bio, ) end end end |