:address, :city, :state, :postal_code, :country, :email, :phone]
end
end
# Params encapsulate the logic to handle some parameters from an untrusted source.
#
# A Params object generally doesn't include the Param module directly. Instead, it relies to one of the
# more specific implementations, such as ParamsAllowed.
module Params
def initialize(params)
@params = ActiveSupport::HashWithIndifferentAccess.new(params.to_h)
end
end
module ParamsAllowed
def self.included(base)
base.include Params
end
def to_h
@params.slice(*self.class.allowed).to_hash.symbolize_keys!
end
end