Ruby on Rails: Where to define global constants?

If your model is really “responsible” for the constants you should stick them there. You can create class methods to access them without creating a new object instance: class Card < ActiveRecord::Base def self.colours [‘white’, ‘blue’] end end # accessible like this Card.colours Alternatively, you can create class variables and an accessor. This is however … Read more

Using global variables between files?

The problem is you defined myList from main.py, but subfile.py needs to use it. Here is a clean way to solve this problem: move all globals to a file, I call this file settings.py. This file is responsible for defining globals and initializing them: # settings.py def init(): global myList myList = [] Next, your … Read more

Global Git ignore

You need to set up your global core.excludesfile configuration file to point to this global ignore file e.g: *nix or Windows git bash: git config –global core.excludesFile ‘~/.gitignore’ Windows cmd: git config –global core.excludesFile “%USERPROFILE%\.gitignore” Windows PowerShell: git config –global core.excludesFile “$Env:USERPROFILE\.gitignore” For Windows it is set to the location C:\Users\%username%\.gitignore. You can verify that … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)