On Monday, 26 May 2014 03:16:26 UTC-4, Ruby-Forum.com User wrote:
>
> Hello, 
>
> When setting the class static variables, These are shared across all the 
> instances created. 
>
> Class A 
>   @@bool_var = true 
>
>   def get_bool_var 
>     @@bool_var 
>   end 
> end 
>
> All the instances will have this static variable, 
> When through a controller, a user requests, Based on some logic, I set 
> the value to false. 
>
> Is this class static variable be set to false in all the other requests 
> from other users on a web application ? 
>
>
The class variable will lose its value between requests in development mode 
due to class reloading. You SHOULD NOT use class variables to do this in 
production, as the value is only available in the process where it was set, 
making multi-process deployments behave in ways you don't expect.

--Matt Jones

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/74f65aa1-d330-44d8-a802-437977ac82bf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to