php - How to access one variable across the page in ruby? -


now new in ruby language. learning ruby. expert coder in php. working in cakephp. cakephp , ruby directory structure approximately same. confusing little bit in ruby code.

in cakephp while define variable in bootstrap.php getting variable across site.

suppose have variable name $gallery_path = 'files/gallery/'; if echo $gallery_path in controller, model , view. getting gallery path.

but here in ruby unable define variable php bootstrap.php please suggest me.

for things change enough need edit them , then, infrequently enough you're not changing it, simple module works here.

you can start this:

module siteconfiguration   mattr_accessor :site_name   mattr_accessor :payment_provider end 

then can configure in config/environment.rb:

siteconfiguration.site_name = 'the site' siteconfiguration.payment_provider = 'paypal' 

these accessible everywhere in app.


Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -