我只是想在个人项目中使用带有导轨的鳄梨酱。
我已经创建了我的 rails 应用程序,设置了我的 guacamole gem,现在正在尝试执行:
rails g model presence public_reference:string solid_reference:string:uniq
这是我第一次尝试使用这种组合,我真的不知道在哪里搜索以及如何调试下面的错误......
我也尝试生成没有参数的模型,但我得到了同样的错误。
Traceback (most recent call last):
33: from bin/rails:7:in `<main>'
32: from bin/rails:7:in `require'
31: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/railties-5.2.3/lib/rails/commands.rb:18:in `<top (required)>'
30: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/railties-5.2.3/lib/rails/command.rb:46:in `invoke'
29: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/railties-5.2.3/lib/rails/command/base.rb:65:in `perform'
28: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
27: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
26: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
25: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/railties-5.2.3/lib/rails/commands/generate/generate_command.rb:21:in `perform'
24: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/railties-5.2.3/lib/rails/command/actions.rb:15:in `require_application_and_environment!'
23: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/railties-5.2.3/lib/rails/command/actions.rb:28:in `require_environment!'
22: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/railties-5.2.3/lib/rails/application.rb:337:in `require_environment!'
21: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/railties-5.2.3/lib/rails/application.rb:337:in `require'
20: from E:/Projets/Rails/exPi/config/environment.rb:5:in `<top (required)>'
19: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/railties-5.2.3/lib/rails/application.rb:361:in `initialize!'
18: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/railties-5.2.3/lib/rails/initializable.rb:60:in `run_initializers'
17: from C:/Ruby25-x64/lib/ruby/2.5.0/tsort.rb:205:in `tsort_each'
16: from C:/Ruby25-x64/lib/ruby/2.5.0/tsort.rb:226:in `tsort_each'
15: from C:/Ruby25-x64/lib/ruby/2.5.0/tsort.rb:347:in `each_strongly_connected_component'
14: from C:/Ruby25-x64/lib/ruby/2.5.0/tsort.rb:347:in `call'
13: from C:/Ruby25-x64/lib/ruby/2.5.0/tsort.rb:347:in `each'
12: from C:/Ruby25-x64/lib/ruby/2.5.0/tsort.rb:349:in `block in each_strongly_connected_component'
11: from C:/Ruby25-x64/lib/ruby/2.5.0/tsort.rb:431:in `each_strongly_connected_component_from'
10: from C:/Ruby25-x64/lib/ruby/2.5.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
9: from C:/Ruby25-x64/lib/ruby/2.5.0/tsort.rb:228:in `block in tsort_each'
8: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/railties-5.2.3/lib/rails/initializable.rb:61:in `block in run_initializers'
7: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/railties-5.2.3/lib/rails/initializable.rb:32:in `run'
6: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/railties-5.2.3/lib/rails/initializable.rb:32:in `instance_exec'
5: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/guacamole-0.4.0/lib/guacamole/railtie.rb:31:in `block in <class:Railtie>'
4: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/guacamole-0.4.0/lib/guacamole/configuration.rb:176:in `load'
3: from C:/Ruby25-x64/lib/ruby/2.5.0/psych.rb:263:in `load'
2: from C:/Ruby25-x64/lib/ruby/2.5.0/psych.rb:350:in `parse'
1: from C:/Ruby25-x64/lib/ruby/2.5.0/psych.rb:402:in `parse_stream'
C:/Ruby25-x64/lib/ruby/2.5.0/psych.rb:402:in `parse': (<unknown>): did not find expected key while parsing a block mapping at line 2 column 3 (Psych::SyntaxError)
细节我忘记了:
鳄梨酱.yml
development:
protocol: 'http'
host: 'localhost'
port: 8529
username: 'root'
password: '<%= MY_CONFIG['password'] %>
database: 'exPi_development'
test:
protocol: 'http'
host: 'localhost'
port: 8529
username: 'root'
password: '<%= MY_CONFIG['password'] %>
database: 'exPi_test'
load_my_config.rb
parent_dir = File.expand_path('..', File.dirname(__FILE__))
credentials_path = File.join(parent_dir, 'credentials.yml')
open_credentials = Psych.load_file(credentials_path)
MY_CONFIG = open_credentials[Rails.env]
垃圾箱/导轨
#!/usr/bin/env ruby.exe
APP_PATH = File.expand_path('../config/application', __dir__)
require_relative '../config/boot'
require 'psych'
require 'rails'
require_relative '../config/initializers/load_my_config'
require 'rails/commands'
凭证.yml
development:
password: 'password'
test:
password: 'password'