# Weirdness with model.send(string).build

**URL:** <https://www.ruby-forum.com/t/weirdness-with-model-send-string-build/127488>\
**Category:** Rails\
**Created:** [January 29, 2008, 7:00pm UTC](https://www.ruby-forum.com/t/weirdness-with-model-send-string-build/127488 "2008-01-29T19:00:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cmaxvv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/85f322/32.png) [@cmaxvv](https://www.ruby-forum.com/u/cmaxvv)\
**Post date:** [January 29, 2008, 7:00pm UTC](https://www.ruby-forum.com/t/weirdness-with-model-send-string-build/127488/1 "2008-01-29T19:00:22Z")

</div>

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

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
