Where to put Global variables in Rails 3

后端 未结 5 1775
旧时难觅i
旧时难觅i 2020-11-30 03:25

I used to put Global variables in environment.rb with my Rails 2.3.8 application such as:

MAX_ALLOWD_ITEMS = 6

It doesn\'t seem to work in

5条回答
  •  长情又很酷
    2020-11-30 03:48

    If you are truly defining it in config/environment.rb like you say, the only way I can duplicate your problem is by running up a server using rails server, then putting in the variable to config/environment.rb, referencing it in a view or controller somewhere and then trying to load that specific part of my application.

    If I stop the server and start it again and again try to access that view or controller then it works. I reckon you just haven't restarted your server.

提交回复
热议问题