# Globals, incremental voting, images

**URL:** <https://www.ruby-forum.com/t/globals-incremental-voting-images/51297>\
**Category:** Rails\
**Created:** [December 29, 2005, 6:51am UTC](https://www.ruby-forum.com/t/globals-incremental-voting-images/51297 "2005-12-29T06:51:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mschwab](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/59ef9b/32.png) [@mschwab](https://www.ruby-forum.com/u/mschwab)\
**Post date:** [December 29, 2005, 6:51am UTC](https://www.ruby-forum.com/t/globals-incremental-voting-images/51297/1 "2005-12-29T06:51:42Z")

</div>

Can I define a global variable (in the ApplicationController perhaps)  
and give it a value that will be accessible in every controller and  
view? Would it add a lot of computational overhead to my site if the  
globals were arrays storing gigabytes of data)?

I want to use a voting system in which the user can click and drag on  
an image to select a score between 0.0 and 5.0 - the number should be  
displayed and the image should rotate or change color or do something  
to visually represent the rating. Does anyone know of any open source  
that does this? Or which javascript functions to use? How much  
bandwidth would it use to record votes via observe\_field :frequency =\>  
10

What is the best Rails syntax for using images as links? Should I  
throw an ![]() tag into the view files as the first argument to  
link\_to? Or can I have globally defined variables that point to my  
image urls?

---

<div class="post-metadata">

**Author:** ![mschwab](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/59ef9b/32.png) [@mschwab](https://www.ruby-forum.com/u/mschwab)\
**Post date:** [December 29, 2005, 7:51am UTC](https://www.ruby-forum.com/t/globals-incremental-voting-images/51297/2 "2005-12-29T07:51:52Z")

</div>

On Dec 28, 2005, at 9:48 PM, Mike S. wrote:

> bandwidth would it use to record votes via observe\_field :frequency =\>

Mike-

```
What about using the slider control in scriptaculous?

```

Cheers-  
-Ezra Z.  
WebMaster  
Yakima Herald-Republic Newspaper  
removed\_email\_address@domain.invalid  
509-577-7732

---

<div class="post-metadata">

**Author:** ![mschwab](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/59ef9b/32.png) [@mschwab](https://www.ruby-forum.com/u/mschwab)\
**Post date:** [December 29, 2005, 8:09am UTC](https://www.ruby-forum.com/t/globals-incremental-voting-images/51297/3 "2005-12-29T08:09:59Z")

</div>

Due to the Shared Nothing architecture of Rails, global variables aren’t  
really global. If you setup to have, say, 4 FCGI processes running, you  
will actually have 4 sets of global variables, and changes to one set  
will  
not be copied to the other sets. This is almost certainly not what you  
want.

Gigabytes of data are best stored in a database, and Rails is pretty  
good at  
using a database.

---

<div class="post-metadata">

**Author:** ![mschwab](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/59ef9b/32.png) [@mschwab](https://www.ruby-forum.com/u/mschwab)\
**Post date:** [December 29, 2005, 9:16am UTC](https://www.ruby-forum.com/t/globals-incremental-voting-images/51297/4 "2005-12-29T09:16:11Z")

</div>

How can I use an observe\_field with two arguments (query and domain) -  
it will only take two arguments and text\_field\_tag only takes one.
