【问题标题】:pry-rails not rails console working with Rails 4.0pry-rails 不是使用 Rails 4.0 的 rails 控制台
【发布时间】:2013-10-03 05:57:02
【问题描述】:
在我的 Gemfile 运行控制台中包含“pry-rails”并获得以下内容
@marketplace-rails/gems/pry-rails-0.2.0/lib/pry-rails/commands.rb:3:in `block in <module:PryRails>': undefined method `create_command' for #<Pry::CommandSet:0x007fcfaa67a878> (NoMethodError)
【问题讨论】:
标签:
ruby-on-rails
ruby-on-rails-4
pry
【解决方案1】:
- 步骤 1. 不要使用“撬轨”? (不知道如何获得该宝石
工作)
- 步骤 2. 在 gemfile 中包含
gem 'pry'
- 步骤 3. 在 application.rb 中包含以下内容...
console do
require "pry"
config.console = Pry
end
run rails console 很高兴能重新打开你的生活。
【解决方案2】:
为了它的价值,我只是尝试了这个:
group :development, :test do
gem 'pry-rails'
end
随后是捆绑安装和“rails c”并撬开了。
【解决方案3】:
尝试停止弹簧,
$ bin/spring stop
安装 gem 后为我工作,甚至不必在 config/environment/development 文件中更改它
【解决方案4】:
确保您的 Gemfile 中已包含 pry 并添加
config.console = Pry
到您的 config/environments/development.rb 或您的 config/application.rb(如果您希望在每个环境中都使用它)。