Hallo Ich habe app_config.yml in meinem Config enthalten bestimmten Code/Ausgabe Mit Blick auf `lesen ': Keine solche Datei oder das Verzeichnis @> in Schienen rb_sysopen
development:
name: mytest
password: secret
production:
name: test
password: Patest
config/application.rb
require File.expand_path('../boot', __FILE__)
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
APP_CONFIG = YAML.load_file("#{::Rails.root}/config/app_config.yml")[::Rails.env]
Jetzt
app/controllers/application_controller.rb
http_basic_authenticate_with :name => APP_CONFIG[:name], :password => APP_CONFIG[:password]
wenn ich Schienen-Server ausführen es gibt mir Folgende Fehler ::
config/application.rb: 8: in
read': No such file or directory @ rb_sysopen - /config/app_config.yml (Errno::ENOENT) from /Users/rails_app/config/application.rb:8:in
'
Bitte leite mich, was ich in meinem Code bin fehlt, wie dieses Problem zu lösen.
hinzugefügt 'to_s' zu Rails.root und überprüft? – Sravan
nein, es funktioniert nicht @Sravan – railslearner
versuchen Sie 'Rails.root.join ('config', 'app_config.yml')' – Sravan