Force error in erb when env var unset?

72 Views Asked by At

If I use <%= ENV['FOO'] %> in an erb template without setting an environment variable named FOO, then it resolves to an empty string.

Is it possible to force an error (index error, anything) at this point instead; evaluating to a string iff $FOO exists?

0

There are 0 best solutions below