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
Post a Comment