Weirdness with model.send(string).build

I’ve got a weird problem which i can work around but want to understand!
:slight_smile:

Let’s say that
name = “small_logo”

This works -

@small_logo = @music_service.send(“small_logo”).build(file_hash)

and this works

@small_logo = @music_service.send("#{name}").build(file_hash)

but this doesn’t work

@small_logo = @music_service.send(name).build(file_hash)

and neither does this

@small_logo = @music_service.send(name.to_s).build(file_hash)

In other words, a string is fine but a variable set to a string isn’t,
unless it’s converted to a string inside #{ }.

Can anyone explain this to me? I don’t know if it’s connected to the
attachment_fu ‘build’ method or if it’s some general ruby weirdness.

thanks
max