- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我最近将 paper_trail 升级到版本 3.0.0
并遇到此错误:
Started GET "/admin/" for 127.0.0.1 at 2013-12-26 18:55:59 +0400
Processing by RailsAdmin::MainController#dashboard as HTML
Admin Load (0.2ms) SELECT "admins".* FROM "admins" WHERE "admins"."id" = 1 LIMIT 1
Completed 500 Internal Server Error in 27.5ms
NameError - uninitialized constant Version:
(gem) activesupport-3.2.16/lib/active_support/dependencies.rb:520:in `load_missing_constant'
(gem) activesupport-3.2.16/lib/active_support/dependencies.rb:192:in `block in const_missing'
(gem) activesupport-3.2.16/lib/active_support/dependencies.rb:190:in `const_missing'
(gem) rails_admin-0.4.9/lib/rails_admin/extensions/paper_trail/auditing_adapter.rb:48:in `latest'
(gem) rails_admin-0.4.9/lib/rails_admin/config/actions/dashboard.rb:17:in `block (2 levels) in <class:Dashboard>'
(eval):8:in `dashboard'
(gem) actionpack-3.2.16/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
(gem) actionpack-3.2.16/lib/abstract_controller/base.rb:167:in `process_action'
(gem) actionpack-3.2.16/lib/action_controller/metal/rendering.rb:10:in `process_action'
(gem) actionpack-3.2.16/lib/abstract_controller/callbacks.rb:18:in `block in process_action'
(gem) activesupport-3.2.16/lib/active_support/callbacks.rb:535:in `_run__3295254136304352753__process_action__548262850884401428__callbacks'
(gem) activesupport-3.2.16/lib/active_support/callbacks.rb:405:in `__run_callback'
(gem) activesupport-3.2.16/lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
(gem) activesupport-3.2.16/lib/active_support/callbacks.rb:81:in `run_callbacks'
(gem) actionpack-3.2.16/lib/abstract_controller/callbacks.rb:17:in `process_action'
(gem) actionpack-3.2.16/lib/action_controller/metal/rescue.rb:29:in `process_action'
(gem) actionpack-3.2.16/lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
(gem) activesupport-3.2.16/lib/active_support/notifications.rb:123:in `block in instrument'
(gem) activesupport-3.2.16/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
(gem) activesupport-3.2.16/lib/active_support/notifications.rb:123:in `instrument'
(gem) actionpack-3.2.16/lib/action_controller/metal/instrumentation.rb:29:in `process_action'
(gem) actionpack-3.2.16/lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
(gem) activerecord-3.2.16/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
(gem) actionpack-3.2.16/lib/abstract_controller/base.rb:121:in `process'
(gem) actionpack-3.2.16/lib/abstract_controller/rendering.rb:45:in `process'
(gem) actionpack-3.2.16/lib/action_controller/metal.rb:203:in `dispatch'
(gem) actionpack-3.2.16/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
(gem) actionpack-3.2.16/lib/action_controller/metal.rb:246:in `block in action'
(gem) actionpack-3.2.16/lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
(gem) actionpack-3.2.16/lib/action_dispatch/routing/route_set.rb:36:in `call'
(gem) journey-1.0.4/lib/journey/router.rb:68:in `block in call'
(gem) journey-1.0.4/lib/journey/router.rb:56:in `call'
(gem) actionpack-3.2.16/lib/action_dispatch/routing/route_set.rb:608:in `call'
(gem) railties-3.2.16/lib/rails/engine.rb:484:in `call'
(gem) railties-3.2.16/lib/rails/railtie/configurable.rb:30:in `method_missing'
(gem) journey-1.0.4/lib/journey/router.rb:68:in `block in call'
(gem) journey-1.0.4/lib/journey/router.rb:56:in `call'
(gem) actionpack-3.2.16/lib/action_dispatch/routing/route_set.rb:608:in `call'
(gem) rack-pjax-0.7.0/lib/rack/pjax.rb:12:in `call'
(gem) bullet-4.6.0/lib/bullet/rack.rb:13:in `call'
(gem) meta_request-0.2.8/lib/meta_request/middlewares/app_request_handler.rb:13:in `call'
(gem) rack-contrib-1.1.0/lib/rack/contrib/response_headers.rb:17:in `call'
(gem) meta_request-0.2.8/lib/meta_request/middlewares/headers.rb:16:in `call'
(gem) meta_request-0.2.8/lib/meta_request/middlewares/meta_request_handler.rb:13:in `call'
(gem) request_store-1.0.5/lib/request_store/middleware.rb:9:in `call'
(gem) galetahub-simple_captcha-0.1.5/lib/simple_captcha/middleware.rb:20:in `call'
(gem) warden-1.2.3/lib/warden/manager.rb:35:in `block in call'
(gem) warden-1.2.3/lib/warden/manager.rb:34:in `call'
(gem) actionpack-3.2.16/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
(gem) rack-1.4.5/lib/rack/etag.rb:23:in `call'
(gem) rack-1.4.5/lib/rack/conditionalget.rb:25:in `call'
(gem) actionpack-3.2.16/lib/action_dispatch/middleware/head.rb:14:in `call'
(gem) remotipart-1.2.1/lib/remotipart/middleware.rb:27:in `call'
(gem) actionpack-3.2.16/lib/action_dispatch/middleware/params_parser.rb:21:in `call'
(gem) actionpack-3.2.16/lib/action_dispatch/middleware/flash.rb:242:in `call'
(gem) rack-1.4.5/lib/rack/session/abstract/id.rb:210:in `context'
(gem) rack-1.4.5/lib/rack/session/abstract/id.rb:205:in `call'
(gem) actionpack-3.2.16/lib/action_dispatch/middleware/cookies.rb:341:in `call'
(gem) activerecord-3.2.16/lib/active_record/query_cache.rb:64:in `call'
(gem) activerecord-3.2.16/lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
(gem) actionpack-3.2.16/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
(gem) activesupport-3.2.16/lib/active_support/callbacks.rb:405:in `_run__689952341354032436__call__3266767755508832131__callbacks'
(gem) activesupport-3.2.16/lib/active_support/callbacks.rb:405:in `__run_callback'
(gem) activesupport-3.2.16/lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
(gem) activesupport-3.2.16/lib/active_support/callbacks.rb:81:in `run_callbacks'
(gem) actionpack-3.2.16/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
(gem) actionpack-3.2.16/lib/action_dispatch/middleware/reloader.rb:65:in `call'
(gem) actionpack-3.2.16/lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
(gem) better_errors-0.7.2/lib/better_errors/middleware.rb:84:in `protected_app_call'
(gem) better_errors-0.7.2/lib/better_errors/middleware.rb:79:in `better_errors_call'
(gem) better_errors-0.7.2/lib/better_errors/middleware.rb:56:in `call'
(gem) actionpack-3.2.16/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
(gem) actionpack-3.2.16/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
(gem) railties-3.2.16/lib/rails/rack/logger.rb:32:in `call_app'
(gem) railties-3.2.16/lib/rails/rack/logger.rb:16:in `block in call'
(gem) activesupport-3.2.16/lib/active_support/tagged_logging.rb:22:in `tagged'
(gem) railties-3.2.16/lib/rails/rack/logger.rb:16:in `call'
(gem) quiet_assets-1.0.2/lib/quiet_assets.rb:18:in `call_with_quiet_assets'
(gem) actionpack-3.2.16/lib/action_dispatch/middleware/request_id.rb:22:in `call'
(gem) rack-1.4.5/lib/rack/methodoverride.rb:21:in `call'
(gem) rack-1.4.5/lib/rack/runtime.rb:17:in `call'
(gem) activesupport-3.2.16/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
(gem) rack-1.4.5/lib/rack/lock.rb:15:in `call'
(gem) actionpack-3.2.16/lib/action_dispatch/middleware/static.rb:63:in `call'
(gem) rack-cache-1.2/lib/rack/cache/context.rb:136:in `forward'
(gem) rack-cache-1.2/lib/rack/cache/context.rb:245:in `fetch'
(gem) rack-cache-1.2/lib/rack/cache/context.rb:185:in `lookup'
(gem) rack-cache-1.2/lib/rack/cache/context.rb:66:in `call!'
(gem) rack-cache-1.2/lib/rack/cache/context.rb:51:in `call'
(gem) railties-3.2.16/lib/rails/engine.rb:484:in `call'
(gem) railties-3.2.16/lib/rails/application.rb:231:in `call'
(gem) rack-1.4.5/lib/rack/content_length.rb:14:in `call'
(gem) railties-3.2.16/lib/rails/rack/log_tailer.rb:17:in `call'
(gem) thin-1.5.1/lib/thin/connection.rb:81:in `block in pre_process'
(gem) thin-1.5.1/lib/thin/connection.rb:79:in `pre_process'
(gem) thin-1.5.1/lib/thin/connection.rb:54:in `process'
(gem) thin-1.5.1/lib/thin/connection.rb:39:in `receive_data'
(gem) eventmachine-1.0.3/lib/eventmachine.rb:187:in `run'
(gem) thin-1.5.1/lib/thin/backends/base.rb:63:in `start'
(gem) thin-1.5.1/lib/thin/server.rb:159:in `start'
(gem) rack-1.4.5/lib/rack/handler/thin.rb:13:in `run'
(gem) rack-1.4.5/lib/rack/server.rb:268:in `start'
(gem) railties-3.2.16/lib/rails/commands/server.rb:70:in `start'
(gem) railties-3.2.16/lib/rails/commands.rb:55:in `block in <top (required)>'
(gem) railties-3.2.16/lib/rails/commands.rb:50:in `<top (required)>'
script/rails:6:in `<main>'
2.7.1
一切都很棒。我还使用 rails 3.2.16 和 rails_admin 0.4.9。我的迁移是:
class CreateVersions < ActiveRecord::Migration
def self.up
create_table :versions do |t|
t.string :item_type, :null => false
t.integer :item_id, :null => false
t.string :event, :null => false
t.string :whodunnit
t.text :object
t.datetime :created_at
end
add_index :versions, [:item_type, :item_id]
end
def self.down
remove_index :versions, [:item_type, :item_id]
drop_table :versions
end
end
class Page < ActiveRecord::Base
has_paper_trail
end
最佳答案
我会说 PaperTrail 3.0 的 Version 类命名空间为 PaperTrail::Version,而 RailsAdmin Paper Trail 适配器正在全局命名空间中寻找 Version 而没有找到它。可能是 fork RailsAdmin gem 并解决问题的快速修复:
https://github.com/sferik/rails_admin/blob/master/lib/rails_admin/extensions/paper_trail/auditing_adapter.rb
从您的堆栈跟踪来看,有问题的代码行是第 48 行,但实际上是第 41 行。可能只需将 '::Version' 更改为 'PaperTrail::Version' 即可修复它。
关于ruby-on-rails - Paper_trail 和 Rails_Admin : NameError - uninitialized constant Version,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20787085/
所以如果我在 C++ 中有这样的东西: char A_char = 'A'; char * myPtr = &A_char; const char * myPtr = &char_A; //point
我试图在我的 Perl 脚本中将魔数(Magic Number)声明为常量,如 perlsub 中所述。但是,我收到警告: $ cat foo.perl use warnings ; use stri
我想为 data Constant a b = Constant a 这是我的直接尝试: instance Foldable (Constant a) where foldr f b (Const
我在客户端和服务器端拆分了我的文件夹,但我没有从父文件夹工作,我表现得好像它们是 2 个不同的文件夹...现在我想部署到 Heroku 但我为此需要一个主文件夹,所以我想更改我的 webpack.co
当函数不修改对象参数时,我总是让它请求一个常量引用,即使引用的对象不是真正的常量。这是错误的吗? 对于包装类,我想这样写: template class Wrapper{ private: B*
核心常量表达式的定义取决于常量表达式的概念,如要点 (2.7.1) 和 (2.9.1) 所示N4140 的。 §5.19/2: A conditional-expression e is a core
我有以下代码片段,它按预期工作。其中 x 是一个变量 var myVariable = (x === 'A' || x=== 'B') ? 'sui' : 'pai'; 但是闭包编译器正在将它转换为
我是一个国际化应用程序。其中一部分在于菜单的国际化。没关系。 通过 GWT,我可以使用 Constants 接口(interface)。 现在我必须国际化该应用程序的帮助,其中包括一些涉及菜单的文本。
在 Bjarne Stroustrup 的 A Tour of C++ 中,每章末尾都列出了一些建议。在第一章的结尾,其中一个写道: Avoid ‘‘magic constants;’’ use sy
创建常量数组的常量数组的语法是什么? 我希望函数参数是常量 char* 字符串的常量数组。 最佳答案 您可以通过将 const 放在第一个星号的右侧来实现,例如 void f(const char *
我有一本带图书馆的 Chef Recipe ,例如库.rb。它包含一个 CONSTANT: CONSTANT = 'constant' 当我为这本 Recipe 编写单元测试时,它总是给我警告: (S
这个问题在这里已经有了答案: 关闭 11 年前。 Possible Duplicate: How to check for equals? (0 == i) or (i == 0) Why does
我有以下代码: constexpr unsigned long long power_function(const unsigned long long prime, const unsigned l
在一个页面上,我有几个 Angular 模块。我为每个模块定义了一个包含模块版本的常量。 var module1 = angular.module('module1').constant('versi
C++14 中的§5.19/3 定义了一个整型常量表达式和一个转换后的常量表达式: An integral constant expression is an expression of integr
如果您打开 R# 选项并转到代码编辑> C# > 命名样式,则有 2 个设置与我非常相似。本地常量和常量字段(私有(private))。一种是 lowerCaseCamel,另一种是 UpperCam
如何将恰好命名为 reverse 的以下方法重写为允许任何枚举类型的泛型方法。 public class TestX { enum Gender { male, female } pu
我和我的一位队友进行了一次有趣的谈话。 CONSTANT.equals(VARIABLE) 是否比 Java 中的 VARIABLE.equals(CONSTANT) 快? 我怀疑这是一个虚假陈述。但
我想在 c 程序中执行脚本 cmd,所以函数 SYSTEM(CONST CHAR) 可以执行它,但我想使用这个函数和 3 个不同的参数写入一次。谁能帮帮我,有没有那种功能。 最佳答案 如果我猜对了,您
VStudio 或 ReSharper 给我以下建议: constant 在这种情况下意味着什么?如果它是当前方法作用域中的一个常量,目的是什么?方法往往很小,因此与常规 var 相比,它不应该有任何
我是一名优秀的程序员,十分优秀!