# Asking for help passing variables with an observe\_field

**URL:** <https://www.ruby-forum.com/t/asking-for-help-passing-variables-with-an-observe-field/134785>\
**Category:** Rails\
**Created:** [April 15, 2008, 2:22am UTC](https://www.ruby-forum.com/t/asking-for-help-passing-variables-with-an-observe-field/134785 "2008-04-15T02:22:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![eggman2001](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/51bf81/32.png) [@eggman2001](https://www.ruby-forum.com/u/eggman2001)\
**Post date:** [April 15, 2008, 2:22am UTC](https://www.ruby-forum.com/t/asking-for-help-passing-variables-with-an-observe-field/134785/1 "2008-04-15T02:22:59Z")

</div>

Hi, I have the following observe field:  
\<%= observe\_field :session\_treatment, :url =\> { :action =\>  
‘retrieve\_rate’ }, :with =\> ‘treatment’ %\>

This passes on the ‘treatment’ variable to the action, but I’d like to  
pass another variable and I’m having a hard time figuring out how to  
write it. Any help would be appreciated.

---

<div class="post-metadata">

**Author:** ![eggman2001](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/51bf81/32.png) [@eggman2001](https://www.ruby-forum.com/u/eggman2001)\
**Post date:** [April 15, 2008, 4:03am UTC](https://www.ruby-forum.com/t/asking-for-help-passing-variables-with-an-observe-field/134785/2 "2008-04-15T04:03:26Z")

</div>

\<%= observe\_field :session\_treatment, :url =\> { :action =\>  
‘retrieve\_rate’ }, :with =\> “‘treatment=’ + value + ‘&somevalue=’ +  
value2” %\>

eggman2001 wrote:

> Hi, I have the following observe field:  
> \<%= observe\_field :session\_treatment, :url =\> { :action =\>  
> ‘retrieve\_rate’ }, :with =\> ‘treatment’ %\>
> 
> This passes on the ‘treatment’ variable to the action, but I’d like to  
> pass another variable and I’m having a hard time figuring out how to  
> write it. Any help would be appreciated.

---

<div class="post-metadata">

**Author:** ![eggman2001](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/51bf81/32.png) [@eggman2001](https://www.ruby-forum.com/u/eggman2001)\
**Post date:** [April 15, 2008, 7:05pm UTC](https://www.ruby-forum.com/t/asking-for-help-passing-variables-with-an-observe-field/134785/3 "2008-04-15T19:05:47Z")

</div>

Thanks, but now I’m having trouble with the ‘value2’ part. I’d like  
this value2 to be a variable I define in my controller - @user.  
However, it seems that this variable isn’t available to the  
observe\_field. Is this correct? And if so, does that mean I have to  
use a hidden form field?

On Apr 14, 10:03 pm, Nathan E. \<rails-mailing-l…@andreas-
