# Change value of variable from config file and store it back

**URL:** <https://www.ruby-forum.com/t/change-value-of-variable-from-config-file-and-store-it-back/106435>\
**Category:** Rails\
**Created:** [June 10, 2007, 3:47pm UTC](https://www.ruby-forum.com/t/change-value-of-variable-from-config-file-and-store-it-back/106435 "2007-06-10T15:47:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rosty](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/87869e/32.png) [@rosty](https://www.ruby-forum.com/u/rosty)\
**Post date:** [June 10, 2007, 3:47pm UTC](https://www.ruby-forum.com/t/change-value-of-variable-from-config-file-and-store-it-back/106435/1 "2007-06-10T15:47:44Z")

</div>

I’m having a global variable that is placed in development.rb. How can I  
change the value of that variable from within the code and store it back  
to the config file?

---

<div class="post-metadata">

**Author:** ![rosty](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/87869e/32.png) [@rosty](https://www.ruby-forum.com/u/rosty)\
**Post date:** [June 10, 2007, 4:20pm UTC](https://www.ruby-forum.com/t/change-value-of-variable-from-config-file-and-store-it-back/106435/2 "2007-06-10T16:20:01Z")

</div>

Dima Hristov wrote:

> I’m having a global variable that is placed in development.rb. How can I  
> change the value of that variable from within the code and store it back  
> to the config file?

I’ve been told in the IRC channel that it is not practical to store it  
in the \*.rb file, and that a better approach would be storing it in my  
custom config file and the code from developemt.rb would load that  
global variable from the config file. I agree with it.
