Ari*_*n L 5 ruby ruby-on-rails ruby-on-rails-3
当我尝试任何 rails,rake在临时服务器我得到了命令no such file to load -- ap (LoadError),
对于 rails s:
/usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.22/lib/bundler/runtime.rb:68:in`require': no such file to load -- ap (LoadError)
xxxx
/config/application.rb:7
Run Code Online (Sandbox Code Playgroud)
对于 rake -T:
rake aborted!
no such file to load -- ap
Run Code Online (Sandbox Code Playgroud)
我的 application.rb档案:
require File.expand_path('../boot', __FILE__)
require 'rails/all'
# If you have a Gemfile, require the gems listed there, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env) if defined?(Bundler)
Run Code Online (Sandbox Code Playgroud)
我的rails和ruby版本:
但是,我可以运行rails s,rails c,rake log:clear在我的本地机器的一切。Gemfile分期中的文件与Gemfile本地。
我在这里想念什么?我该如何解决?
在您的 中Gemfile,更改此行:
gem "awesome_print", :require => "ap"
Run Code Online (Sandbox Code Playgroud)
...到这个:
gem "awesome_print"
Run Code Online (Sandbox Code Playgroud)
我刚刚发生了同样的事情。 ap是 的自定义别名awesome_print。这允许你做类似的事情ap Product.first,它会为你很好地打印出来。比打字容易多了awesome_print Product.first
我不知道为什么,但是当这发生在我身上时,我删除了别名,并且加载没有问题。这里可能还有一些比我更聪明的人可以解释的事情,但我知道这对我有用。