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 <img src> 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?
On Dec 28, 2005, at 9:48 PM, Mike Schwab wrote:> 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 <img src> 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? > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >Mike- What about using the slider control in scriptaculous? Cheers- -Ezra Zygmuntowicz WebMaster Yakima Herald-Republic Newspaper ezra-gdxLOakOTQ9oetBuM9ipNAC/G2K4zDHf@public.gmane.org 509-577-7732
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. -----Original Message----- From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Mike Schwab Sent: Wednesday, December 28, 2005 9:49 PM To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: [Rails] globals, incremental voting, images 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 <img src> 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? _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails