ruby - Creating a global variable to all the controllers in Rails -


i have base url common controllers. want declare variable in 1 place, , use in controllers. make future updates fast , simple. possible? i'm declaring in controllers this:

@baseurl = "www.url.com/something/" 

take advantage of ruby's inheritance chain. can define on parent class of controllers constant, applicationcontroller:

class applicationcontroller < actioncontroller::base   base_url = "www.url.com/something/" end 

then become available children, namely postscontroller < applicationcontroller.


Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -