mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-25 20:46:48 +00:00
22 lines
460 B
Ruby
22 lines
460 B
Ruby
# frozen_string_literal: true
|
|
|
|
module PermittedAttributes
|
|
class User
|
|
def initialize(params, resource_name = :user)
|
|
@params = params
|
|
@resource_name = resource_name
|
|
end
|
|
|
|
def call(extra_permitted_attributes = [])
|
|
@params.require(@resource_name).
|
|
permit(permitted_attributes + extra_permitted_attributes)
|
|
end
|
|
|
|
private
|
|
|
|
def permitted_attributes
|
|
[:email, :password, :password_confirmation]
|
|
end
|
|
end
|
|
end
|