没有此类文件要加载-ap(LoadError)

Ari*_*n L 5 ruby ruby-on-rails ruby-on-rails-3

当我尝试任何 railsrake在临时服务器我得到了命令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版本:3.0.11
  • 分期中的ruby版本:ruby 1.8.7(2012-02-08 patchlevel 358)
  • 本地的红宝石版本:红宝石1.8.7(2011-06-30补丁程序352)

但是,我可以运行rails srails crake log:clear在我的本地机器的一切。Gemfile分期中的文件与Gemfile本地。

我在这里想念什么?我该如何解决?

Ada*_*nas 5

在您的 中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

我不知道为什么,但是当这发生在我身上时,我删除了别名,并且加载没有问题。这里可能还有一些比我更聪明的人可以解释的事情,但我知道这对我有用。