我刚刚创建了一个新的 Rails API 应用程序,我第一次尝试运行它。我安装了工头 gem,我正在使用命令
foreman start
启动服务器,但我收到这些错误:
Exiting
21:52:55 web.1 |
/Users/AM/Documents/RailsWS/app1229/config/initializers/wrap_parameters.rb:8:in
`block in <top (required)>':
undefined method `wrap_parameters' for ActionController::API:Class (NoMethodError)
21:52:55 web.1 |
from /Users/AM/.rvm/gems/ruby-1.9.3-p194-gemset/gems/activesupport-
3.2.8/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
21:52:55 web.1 |
from /Users/AM/.rvm/gems/ruby-1.9.3-p194-gemset/gems/activesupport-
3.2.8/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
21:52:55 web.1 |
from /Users/AM/.rvm/gems/ruby-1.9.3-p194-gemset/gems/activesupport-
3.2.8/lib/active_support/lazy_load_hooks.rb:26:in `block in on_lo
..........
我已经尝试更新 gemset 并重新评估终端等。
然而,没有任何工作。想知道是否有人可以提供有关如何继续诊断此错误来源的想法
谢谢
编辑这里是 ApplicationController.rb 的内容
class ApplicationController < ActionController::API
include ActionController::MimeResponds
include ActionController::ImplicitRender
end
宝石文件:
source 'https://rubygems.org'
gem 'rails', '3.2.8'
gem 'rails-api'
gem 'pg'
gem 'thin'
gem 'foreman'
gem 'rabl'
gem "paperclip"
gem 'aws-sdk'
group :development do
gem 'annotate', :git=>'git://github.com/ctran/annotate_models.git'
gem 'debugger'
end
错误指向此文件中的第 8 行:wrap_parameters.rb
# Be sure to restart your server when you modify this file.
#
# This file contains settings for ActionController::ParamsWrapper which
# is enabled by default.
# Enable parameter wrapping for JSON. You can disable this by setting :format to an
empty array.
ActiveSupport.on_load(:action_controller) do
ERROR >>>> wrap_parameters format: [:json]
end
# Disable root element in JSON by default.
ActiveSupport.on_load(:active_record) do
self.include_root_in_json = false
end