Where is the correct place to insert odd snippets of configuration code in Ruby such as the config for awesome_print? -


sometimes need insert chunk of code rails app perform kind of config. seem missing regards should go. let's say, example, awesome_print. eliminate it's color printing use in logs , need in production , staging only.

i've tried inserting environment.rb, application.rb, initializer , such, yet none of these appropriate. each result in various errors.

where insert config line such as:

if rails_env == 'production'   ap object, options = {:plain =>true} if 

your code example doesn't work because object undefined. if want set defaults gem can create file called awesome_print.rb in initializers directory.

if rails.env.production? || rails.env.staging?   awesomeprint.defaults = {     :plain => true   } end 

see 'setting custom defaults' section on github page: https://github.com/michaeldv/awesome_print

the linked section uses .aprc file in user's home directory should work same initializer.


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -