PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, August 19, 2022

[FIXED] Why are my gem 'dotenv-rails' variables not loading?

 August 19, 2022     environment-variables, ruby-on-rails     No comments   

Issue

  • gem 'dotenv-rails' is required in gemfile test and development environments.
  • .env file is saved in root
  • I believe variables use correct syntax; USERNAME=username
  • I am using Rails 5.0.4
  • I have not required 'dotenv-rails' anywhere, as the docs do not suggest that I need to.

When playing in the console, the only way I can access the variables is by calling, Dotenv.load in each session. Suggesting that Dotenv.load should be called somewhere in config of my app.


Solution

Add Dotenv::Railtie.load to your config/application.rb



Answered By - Lucas Moulin
Answer Checked By - Clifford M. (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing