# Newbie question: what does string\[:symbol\] mean?

**URL:** <https://www.ruby-forum.com/t/newbie-question-what-does-string-symbol-mean/113569>\
**Category:** Rails\
**Created:** [September 2, 2007, 12:39am UTC](https://www.ruby-forum.com/t/newbie-question-what-does-string-symbol-mean/113569 "2007-09-02T00:39:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![wawaloo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/bc8723/32.png) [@wawaloo](https://www.ruby-forum.com/u/wawaloo)\
**Post date:** [September 2, 2007, 12:39am UTC](https://www.ruby-forum.com/t/newbie-question-what-does-string-symbol-mean/113569/1 "2007-09-02T00:39:39Z")

</div>

I found this in many rails source codes: string[:symbol]

```
'Some string'[:some_symbol']
```
Can someone tell me what it stands for?

Thks
```
```

---

<div class="post-metadata">

**Author:** ![wawaloo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/bc8723/32.png) [@wawaloo](https://www.ruby-forum.com/u/wawaloo)\
**Post date:** [September 2, 2007, 12:44am UTC](https://www.ruby-forum.com/t/newbie-question-what-does-string-symbol-mean/113569/2 "2007-09-02T00:44:59Z")

</div>

This is likely a Haah reference – the string is the name of the Hash  
object, and the symbol within is a key. For more on symbols, see:

[http://glu.ttono.us/articles/2005/08/19/understanding-ruby-symbols](http://glu.ttono.us/articles/2005/08/19/understanding-ruby-symbols)

-faisal

---

<div class="post-metadata">

**Author:** ![wawaloo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/bc8723/32.png) [@wawaloo](https://www.ruby-forum.com/u/wawaloo)\
**Post date:** [September 2, 2007, 12:56am UTC](https://www.ruby-forum.com/t/newbie-question-what-does-string-symbol-mean/113569/3 "2007-09-02T00:56:06Z")

</div>

Thanks Faisal,

I read almost all you can find about symbols and the string class, but I  
couldn’t find how this must be helpful. For example, in the Beast forum  
source code, a lot of messages in the rhtml files are writen this way:

##### \<%= 'What is Beast?'[:beast\_sidebar\_title]%\>
or \<%= 'A small, light-weight forum in Rails with a scary name and a goal of around 500 lines of code when we\'re done.'[:beast\_sidebar\_body] %\>

Is it something related to localization? Or can you access something  
with this symbol?

---

<div class="post-metadata">

**Author:** ![wawaloo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/bc8723/32.png) [@wawaloo](https://www.ruby-forum.com/u/wawaloo)\
**Post date:** [September 2, 2007, 1:01am UTC](https://www.ruby-forum.com/t/newbie-question-what-does-string-symbol-mean/113569/4 "2007-09-02T01:01:02Z")

</div>

On 9/1/07, Wahid L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I read almost all you can find about symbols and the string class, but I  
> couldn’t find how this must be helpful. For example, in the Beast forum  
> source code, a lot of messages in the rhtml files are writen this way:
> 
> ##### \<%= 'What is Beast?'[:beast\_sidebar\_title]%\>
> or \<%= 'A small, light-weight forum in Rails with a scary name and a goal of around 500 lines of code when we\'re done.'[:beast\_sidebar\_body] %\>
> 
> Is it something related to localization? Or can you access something  
> with this symbol?

Yup, localization. Beast uses the Gibberish plugin to this end.

[http://errtheblog.com/post/4396](http://errtheblog.com/post/4396)

–  
Chris W.  
[http://errfree.com](http://errfree.com) // [http://errtheblog.com](http://errtheblog.com)
