Sorry, I'm not even sure how to ask this question.. so if you could suggest around that as well, it would be appreciated.
# A. WORKS, but "stockroom" is hardcoded
render partial: association.to_s.singularize + '',
locals: {stockroom: new_object}
# B. WORKS, but uses old syntax
render partial: association.to_s.singularize + '',
locals: {association.to_s.singularize.to_sym => new_object}
# C. does NOT work
render partial: association.to_s.singularize + '',
locals: {association.to_s.singularize.to_sym: new_object}
# D. does NOT work
ass = association.to_s.singularize.to_sym
logger.debug "--- ass: #{ass.inspect} (#{ass.class})"
# => --- ass: :stockroom (Symbol)
render partial: association.to_s.singularize + '', locals: {ass: new_object}
Not that the old syntax is a bad thing, I'm just wondering if there's a way to do this using the new syntax (even via an intermediary (i.e. ass)).