# Url, hash, flatten, etc

**URL:** <https://www.ruby-forum.com/t/url-hash-flatten-etc/89122>\
**Category:** Rails\
**Created:** [March 17, 2007, 2:26pm UTC](https://www.ruby-forum.com/t/url-hash-flatten-etc/89122 "2007-03-17T14:26:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pierre-Alexandre\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c4cdca/32.png) [@Pierre-Alexandre\_M](https://www.ruby-forum.com/u/Pierre-Alexandre_M)\
**Post date:** [March 17, 2007, 2:26pm UTC](https://www.ruby-forum.com/t/url-hash-flatten-etc/89122/1 "2007-03-17T14:26:01Z")

</div>

Hi,

I have a form which generates statistics:

form.rhtml --\> /my\_big\_app/stats/generate --\> view\_results.rhtml

My method ‘generate’ generates an array of statistics @results =  
[hash\_1,hash\_2,etc.] and I want to display graphics with gruff in my  
view\_results.rhtml page:

@results.each do |result|  
generate\_graphic(result)  
end

My helper generate\_graphic simply renders (I can’t use  
image\_tag since it automatically adds now a .png).

So how can I easily pass my hashes to my graph\_controller? I want to  
have a params[:stats] = my\_hash for the generate\_image method but I need  
to flatten the hash which is ugly with a whole bunch of data.

Do you have any idea?

–  
,========================.  
| Pierre-Alexandre M. |  
| email : removed\_email\_address@domain.invalid |  
`========================’

---

<div class="post-metadata">

**Author:** ![Pierre-Alexandre\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c4cdca/32.png) [@Pierre-Alexandre\_M](https://www.ruby-forum.com/u/Pierre-Alexandre_M)\
**Post date:** [March 17, 2007, 2:38pm UTC](https://www.ruby-forum.com/t/url-hash-flatten-etc/89122/2 "2007-03-17T14:38:03Z")

</div>

Pierre-Alexandre M. wrote:

> @results.each do |result|
> 
> Do you have any idea?

Store it directly in the session object or store it somewhere else and  
point to it with the session id?

–  
Michael W.

---

<div class="post-metadata">

**Author:** ![Pierre-Alexandre\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c4cdca/32.png) [@Pierre-Alexandre\_M](https://www.ruby-forum.com/u/Pierre-Alexandre_M)\
**Post date:** [March 17, 2007, 5:05pm UTC](https://www.ruby-forum.com/t/url-hash-flatten-etc/89122/3 "2007-03-17T17:05:22Z")

</div>

On Sat, Mar 17, 2007 at 06:38:13AM -0700, Michael W. wrote :

> Store it directly in the session object or store it somewhere else and  
> point to it with the session id?

Actually, it’s what I’m currently doing but I’m not persuaded it’s the  
proper.superlative (propest? sounds weird) way to do this, since it’s a  
lot of information which is periodically updated.

–  
,========================.  
| Pierre-Alexandre M. |  
| email : removed\_email\_address@domain.invalid |  
`========================’
