mercredi 10 mars 2021

Setting up database for the first time in ruby on rails

I am very much fresh in using Ruby on rails. I have cloned a git repo and trying to set up a PostgreSQL database in my local machine(Win 10).

Ruby version- 2.4.10
Rails - 5.2.0

I am using the below command

rake db:setup RAILS_ENV=development

Error Output -

rake aborted!
NoMethodError: undefined method `[]' for nil:NilClass
D:/ruby/reserves/config/environments/development.rb:41:in `block in <top (required)>'
D:/ruby/reserves/config/environments/development.rb:1:in `<top (required)>'
D:/ruby/reserves/config/environment.rb:5:in `<top (required)>'
Tasks: TOP => db:setup => db:schema:load_if_ruby => db:create => db:load_config => environment
(See full trace by running task with --trace) 

In database.yml file there are three environments has been declared - Development/Production/test

development:
  <<: *default
  database: reserves-dev
  username:****
  password:****
  host: localhost

How can I set the environment variable to development for setting the database in my local.

Any help is highly appreciated.

Thank you in advance.

Aucun commentaire:

Enregistrer un commentaire