I have a Settings class on a Rails app with several columns updateable by an admin user in the backend, f.i. support_email, so I want to re-evaluate this column every time the app sends an email after a new user sign up.
I tried with a stubby lambda in the Devise initializer, like scopes in classes:
Devise.setup do |config|
# Omitted config
config.mailer_sender = -> { "AppName <#{Settings.get(:support_email)}>" }
# Omitted config
end
but it doesn't work because it returns a Proc object.
I tried with .call directly in the stubby lambda, although I don't know if it's a good practice:
Devise.setup do |config|
# Omitted config
config.mailer_sender = -> { "AppName <#{Settings.get(:support_email)}>" }.call
# Omitted config
end
This approach doesn't work because I receive the same value that I received after first evaluation.
Any suggestions, please?