# Problem with hash

**URL:** <https://www.ruby-forum.com/t/problem-with-hash/125742>\
**Category:** Rails\
**Created:** [January 11, 2008, 5:04pm UTC](https://www.ruby-forum.com/t/problem-with-hash/125742 "2008-01-11T17:04:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rubylicious](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/91b2a8/32.png) [@rubylicious](https://www.ruby-forum.com/u/rubylicious)\
**Post date:** [January 11, 2008, 5:04pm UTC](https://www.ruby-forum.com/t/problem-with-hash/125742/1 "2008-01-11T17:04:22Z")

</div>

I’m opening a view and passing multiple key/value pairs within one  
symbol like so:

\<%= link\_to ‘view’, {:controller =\> ‘screens’,  
:action =\> “content”,  
:data =\> {“title” =\> “Body”, “content” =\>  
screen.body}} %\>

What’s the proper way to access these from the view I’m rendering? I  
can access the params object to get at the info if I’m only passing one  
value, but I’m having problems getting at both key/value pairs.

I’ve tried multiple variations of the following with no success:

\<%= params[:data[“title”]] %\>

Thanks,

---

<div class="post-metadata">

**Author:** ![rubylicious](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/91b2a8/32.png) [@rubylicious](https://www.ruby-forum.com/u/rubylicious)\
**Post date:** [January 11, 2008, 5:11pm UTC](https://www.ruby-forum.com/t/problem-with-hash/125742/2 "2008-01-11T17:11:38Z")

</div>

On 11 Jan 2008, at 16:04, Corey M. wrote:

> can access the params object to get at the info if I’m only passing  
> one  
> value, but I’m having problems getting at both key/value pairs.
> 
> I’ve tried multiple variations of the following with no success:
> 
> \<%= params[:data[“title”]] %\>

params[:data][:title]  
(the params hash is magic so it doesn’t matter if you use strings or  
keys)

Fred

---

<div class="post-metadata">

**Author:** ![rubylicious](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/91b2a8/32.png) [@rubylicious](https://www.ruby-forum.com/u/rubylicious)\
**Post date:** [January 11, 2008, 5:20pm UTC](https://www.ruby-forum.com/t/problem-with-hash/125742/3 "2008-01-11T17:20:06Z")

</div>

Frederick C. wrote:

> params[:data][:title]  
> (the params hash is magic so it doesn’t matter if you use strings or  
> keys)
> 
> Fred

Works perfectly. Thanks Fred.
