我正在尝试使用
将Log4r与来自活动支持的静音记录器连接起来Log4r.send:include, ActiveRecord的:: SessionStore :: EXTENSION :: LoggerSilencer
但是现在如果我尝试启动服务器,我会收到此错误:
我用
尝试了require 'active_support/all'
在我的session_store.rb
和log4r.rb
中,但总是会遇到同样的错误。任何有想法如何解决这个问题的人?
C:/Ruby200/lib/ruby/gems/2.0.0/gems/activerecord-session_store-1.0.0/lib/active_record/session_store/extension/logger_silencer.rb:16:in `block in <module:LoggerSilencer>': undefined method `cattr_accessor' for Log4r:Module (NoMethodError)
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/activesupport-4.0.13/lib/active_support/concern.rb:114:in `class_eval'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/activesupport-4.0.13/lib/active_support/concern.rb:114:in `append_features'
from C:/SVN/FOS/branches/FOS_5_0/config/initializers/session_store.rb:4:in `include'
from C:/SVN/FOS/branches/FOS_5_0/config/initializers/session_store.rb:4:in `<top (required)>'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/activesupport-4.0.13/lib/active_support/dependencies.rb:223:in `load'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/activesupport-4.0.13/lib/active_support/dependencies.rb:223:in `block in load'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/activesupport-4.0.13/lib/active_support/dependencies.rb:214:in `load_dependency'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/activesupport-4.0.13/lib/active_support/dependencies.rb:223:in `load'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.13/lib/rails/engine.rb:609:in `block (2 levels) in <class:Engine>'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.13/lib/rails/engine.rb:608:in `each'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.13/lib/rails/engine.rb:608:in `block in <class:Engine>'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.13/lib/rails/initializable.rb:30:in `instance_exec'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.13/lib/rails/initializable.rb:30:in `run'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.13/lib/rails/initializable.rb:55:in `block in run_initializers'
from C:/Ruby200/lib/ruby/2.0.0/tsort.rb:150:in `block in tsort_each'
from C:/Ruby200/lib/ruby/2.0.0/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'
from C:/Ruby200/lib/ruby/2.0.0/tsort.rb:210:in `block (2 levels) in each_strongly_connected_component_from'
from C:/Ruby200/lib/ruby/2.0.0/tsort.rb:219:in `each_strongly_connected_component_from'
from C:/Ruby200/lib/ruby/2.0.0/tsort.rb:209:in `block in each_strongly_connected_component_from'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.13/lib/rails/initializable.rb:44:in `each'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.13/lib/rails/initializable.rb:44:in `tsort_each_child'
from C:/Ruby200/lib/ruby/2.0.0/tsort.rb:203:in `each_strongly_connected_component_from'
from C:/Ruby200/lib/ruby/2.0.0/tsort.rb:182:in `block in each_strongly_connected_component'
from C:/Ruby200/lib/ruby/2.0.0/tsort.rb:180:in `each'
from C:/Ruby200/lib/ruby/2.0.0/tsort.rb:180:in `each_strongly_connected_component'
from C:/Ruby200/lib/ruby/2.0.0/tsort.rb:148:in `tsort_each'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.13/lib/rails/initializable.rb:54:in `run_initializers'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.13/lib/rails/application.rb:215:in `initialize!'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.13/lib/rails/railtie/configurable.rb:30:in `method_missing'
from C:/SVN/FOS/branches/FOS_5_0/config/environment.rb:7:in `<top (required)>'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/activesupport-4.0.13/lib/active_support/dependencies.rb:229:in `require'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/activesupport-4.0.13/lib/active_support/dependencies.rb:229:in `block in require'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/activesupport-4.0.13/lib/active_support/dependencies.rb:214:in `load_dependency'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/activesupport-4.0.13/lib/active_support/dependencies.rb:229:in `require'
from C:/SVN/FOS/branches/FOS_5_0/config.ru:3:in `block in <main>'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/rack-1.5.5/lib/rack/builder.rb:55:in `instance_eval'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/rack-1.5.5/lib/rack/builder.rb:55:in `initialize'
from C:/SVN/FOS/branches/FOS_5_0/config.ru:in `new'
from C:/SVN/FOS/branches/FOS_5_0/config.ru:in `<main>'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/rack-1.5.5/lib/rack/builder.rb:49:in `eval'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/rack-1.5.5/lib/rack/builder.rb:49:in `new_from_string'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/rack-1.5.5/lib/rack/builder.rb:40:in `parse_file'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/rack-1.5.5/lib/rack/server.rb:277:in `build_app_and_options_from_config'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/rack-1.5.5/lib/rack/server.rb:199:in `app'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.13/lib/rails/commands/server.rb:48:in `app'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/rack-1.5.5/lib/rack/server.rb:314:in `wrapped_app'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.13/lib/rails/commands/server.rb:75:in `start'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.13/lib/rails/commands.rb:76:in `block in <top (required)>'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.13/lib/rails/commands.rb:71:in `tap'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.13/lib/rails/commands.rb:71:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
答案 0 :(得分:0)
cattr_accessor
应该是第16行attr_accessor
文件中的logger_silencer.rb
。我非常确定,如果不是,请使用。
答案 1 :(得分:0)
解决方案:
我更新了我的Log4r,因为我使用的旧版本与新的rails不兼容。现在它有效。