When if params[:query] was nil, it gets error to display @messages in view.
How can I set “” to @foo when if params[:query] was nil?
@foo = params[:query]
@messages = 'I got this value' + @foo + 'etcs'
I want something like this
@messages = ‘I got this value’ + (try(@foo) || “”) + ‘etcs’
Forcibly convert the value to a string using
to_s.nil.to_sresults in a blank string.