Possible Duplicate:
Where to put Global variables in Rails 3
Is it possible to set Site-Wide Global Variables in Ruby开发者_高级运维 on Rails?
It is bad practice
$my_global_var = "I am very bad variable!"
- http://www.rubyist.net/~slagell/ruby/globalvars.html
- http://rubylearning.com/satishtalim/ruby_summary2.html
You can use general Ruby syntax $var_name, but I don't know any case when global variable is a best approach.
精彩评论