2013-03-05 72 views
0

我安裝了活動管理,這是我碰到 http://www.rqna.net/qna/mrumzr-argumenterror-in-activeadmin-devise-sessionscontroller-create.html如何在Ruby on Rails中全局重命名一個函數?

來到我想改名「sign_in」功能在全球範圍內「sign_in_」同樣的錯誤。我怎樣才能正確地做到這一點?我不想惹事。

這個方法我試過: 模塊SessionsHelper 別名:sign_in_:sign_in 民主基金:sign_in 結束

但它給我這個錯誤,當我嘗試啓動我的Rails服務器。下面是在命令提示符下完整的錯誤消息輸出

 Called from: C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/action 
pack-3.2.3/lib/action_dispatch/middleware/session/abstract_store.rb:28:in `initi 
alize'. 

Exiting 
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.3/lib/act 
ive_support/dependencies.rb:469:in `load': C:/Users/Me/Desktop/sample_app/app/he 
lpers/sessions_helper.rb:48: syntax error, unexpected keyword_end, expecting $en 
d (SyntaxError) 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:469:in `block in load_file' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:639:in `new_constants_in' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:468:in `load_file' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:353:in `require_or_load' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:313:in `depend_on' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:225:in `require_dependency' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2 
.3/lib/abstract_controller/helpers.rb:135:in `block in modules_for_helpers' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2 
.3/lib/abstract_controller/helpers.rb:131:in `map!' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2 
.3/lib/abstract_controller/helpers.rb:131:in `modules_for_helpers' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2 
.3/lib/action_controller/metal/helpers.rb:92:in `modules_for_helpers' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2 
.3/lib/abstract_controller/helpers.rb:95:in `helper' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2 
.3/lib/action_controller/railties/paths.rb:18:in `block (2 levels) in with' 
     from C:/Users/Me/Desktop/sample_app/app/controllers/application_controll 
er.rb:1:in `<top (required)>' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:469:in `load' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:469:in `block in load_file' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:639:in `new_constants_in' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:468:in `load_file' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:353:in `require_or_load' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:502:in `load_missing_constant' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:192:in `block in const_missing' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:190:in `each' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:190:in `const_missing' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/inherited_reso 
urces-1.3.1/app/controllers/inherited_resources/base.rb:11:in `<module:Inherited 
Resources>' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/inherited_reso 
urces-1.3.1/app/controllers/inherited_resources/base.rb:1:in `<top (required)>' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:469:in `load' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:469:in `block in load_file' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:639:in `new_constants_in' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:468:in `load_file' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:353:in `require_or_load' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:502:in `load_missing_constant' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:192:in `block in const_missing' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:190:in `each' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:190:in `const_missing' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activeadmin-0. 
5.1/lib/active_admin/base_controller/menu.rb:2:in `<module:ActiveAdmin>' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activeadmin-0. 
5.1/lib/active_admin/base_controller/menu.rb:1:in `<top (required)>' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:251:in `require' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:251:in `block in require' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:236:in `load_dependency' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:251:in `require' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activeadmin-0. 
5.1/lib/active_admin/base_controller.rb:2:in `<top (required)>' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activeadmin-0. 
5.1/lib/active_admin/resource_controller/actions.rb:2:in `<module:ActiveAdmin>' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activeadmin-0. 
5.1/lib/active_admin/resource_controller/actions.rb:1:in `<top (required)>' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:251:in `require' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:251:in `block in require' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:236:in `load_dependency' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:251:in `require' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activeadmin-0. 
5.1/lib/active_admin/resource_controller.rb:2:in `<top (required)>' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activeadmin-0. 
5.1/lib/active_admin/batch_actions.rb:7:in `block in <top (required)>' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activeadmin-0. 
5.1/lib/active_admin/event.rb:25:in `call' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activeadmin-0. 
5.1/lib/active_admin/event.rb:25:in `block in dispatch' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activeadmin-0. 
5.1/lib/active_admin/event.rb:24:in `each' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activeadmin-0. 
5.1/lib/active_admin/event.rb:24:in `dispatch' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activeadmin-0. 
5.1/lib/active_admin/application.rb:187:in `load!' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activeadmin-0. 
5.1/lib/active_admin/application.rb:213:in `routes' 
     from C:in `routes' 
     from C:/Users/Me/Desktop/sample_app/config/routes.rb:2:in `block in <top 
(required)>' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2 
.3/lib/action_dispatch/routing/route_set.rb:282:in `instance_exec' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2 
.3/lib/action_dispatch/routing/route_set.rb:282:in `eval_block' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2 
.3/lib/action_dispatch/routing/route_set.rb:260:in `draw' 
     from C:/Users/Me/Desktop/sample_app/config/routes.rb:1:in `<top (require 
d)>' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:245:in `load' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:245:in `block in load' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:236:in `load_dependency' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:245:in `load' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3 
/lib/rails/application/routes_reloader.rb:40:in `block in load_paths' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3 
/lib/rails/application/routes_reloader.rb:40:in `each' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3 
/lib/rails/application/routes_reloader.rb:40:in `load_paths' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3 
/lib/rails/application/routes_reloader.rb:16:in `reload!' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3 
/lib/rails/application.rb:108:in `reload_routes!' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activeadmin-0. 
5.1/lib/active_admin/reloader.rb:34:in `reload!' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activeadmin-0. 
5.1/lib/active_admin/reloader.rb:61:in `block in attach!' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/callbacks.rb:429:in `_run__63132682__prepare__586461675 
__callbacks' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/callbacks.rb:405:in `__run_callback' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/callbacks.rb:385:in `_run_prepare_callbacks' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/callbacks.rb:81:in `run_callbacks' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2 
.3/lib/action_dispatch/middleware/reloader.rb:74:in `prepare!' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2 
.3/lib/action_dispatch/middleware/reloader.rb:48:in `prepare!' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3 
/lib/rails/application/finisher.rb:47:in `block in <module:Finisher>' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3 
/lib/rails/initializable.rb:30:in `instance_exec' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3 
/lib/rails/initializable.rb:30:in `run' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3 
/lib/rails/initializable.rb:55:in `block in run_initializers' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3 
/lib/rails/initializable.rb:54:in `each' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3 
/lib/rails/initializable.rb:54:in `run_initializers' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3 
/lib/rails/application.rb:136:in `initialize!' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3 
/lib/rails/railtie/configurable.rb:30:in `method_missing' 
     from C:/Users/Me/Desktop/sample_app/config/environment.rb:5:in `<top (re 
quired)>' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:251:in `require' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:251:in `block in require' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:236:in `load_dependency' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:251:in `require' 
     from C:/Users/Me/Desktop/sample_app/config.ru:3:in `block in <main>' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib 
/rack/builder.rb:51:in `instance_eval' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib 
/rack/builder.rb:51:in `initialize' 
     from C:/Users/Me/Desktop/sample_app/config.ru:in `new' 
     from C:/Users/Me/Desktop/sample_app/config.ru:in `<main>' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib 
/rack/builder.rb:40:in `eval' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib 
/rack/builder.rb:40:in `parse_file' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib 
/rack/server.rb:200:in `app' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3 
/lib/rails/commands/server.rb:46:in `app' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib 
/rack/server.rb:304:in `wrapped_app' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib 
/rack/server.rb:254:in `start' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3 
/lib/rails/commands/server.rb:70:in `start' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3 
/lib/rails/commands.rb:55:in `block in <top (required)>' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3 
/lib/rails/commands.rb:50:in `tap' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3 
/lib/rails/commands.rb:50:in `<top (required)>' 
     from script/rails:6:in `require' 
     from script/rails:6:in `<main>' 

C:\Users\Me\Desktop\sample_app> 

後來,當我只包括別名和民主基金系沒有我sessionhelper文件中的「結束」,我在嘗試重新啓動服務器

如果出現以下錯誤輸出
Exiting 
C:/Users/Me/Desktop/sample_app/app/helpers/sessions_helper.rb:3:in `<module:Sess 
ionsHelper>': undefined method `sign_in' for module `SessionsHelper' (NameError) 

     from C:/Users/Me/Desktop/sample_app/app/helpers/sessions_helper.rb:1:in 
`<top (required)>' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:469:in `load' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:469:in `block in load_file' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:639:in `new_constants_in' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:468:in `load_file' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:353:in `require_or_load' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:313:in `depend_on' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:225:in `require_dependency' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2 
.3/lib/abstract_controller/helpers.rb:135:in `block in modules_for_helpers' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2 
.3/lib/abstract_controller/helpers.rb:131:in `map!' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2 
.3/lib/abstract_controller/helpers.rb:131:in `modules_for_helpers' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2 
.3/lib/action_controller/metal/helpers.rb:92:in `modules_for_helpers' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2 
.3/lib/abstract_controller/helpers.rb:95:in `helper' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2 
.3/lib/action_controller/railties/paths.rb:18:in `block (2 levels) in with' 
     from C:/Users/Me/Desktop/sample_app/app/controllers/application_controll 
er.rb:1:in `<top (required)>' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:469:in `load' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:469:in `block in load_file' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:639:in `new_constants_in' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:468:in `load_file' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:353:in `require_or_load' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:502:in `load_missing_constant' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:192:in `block in const_missing' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:190:in `each' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:190:in `const_missing' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/inherited_reso 
urces-1.3.1/app/controllers/inherited_resources/base.rb:11:in `<module:Inherited 
Resources>' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/inherited_reso 
urces-1.3.1/app/controllers/inherited_resources/base.rb:1:in `<top (required)>' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:469:in `load' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:469:in `block in load_file' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:639:in `new_constants_in' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:468:in `load_file' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:353:in `require_or_load' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:502:in `load_missing_constant' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:192:in `block in const_missing' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:190:in `each' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:190:in `const_missing' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activeadmin-0. 
5.1/lib/active_admin/base_controller/menu.rb:2:in `<module:ActiveAdmin>' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activeadmin-0. 
5.1/lib/active_admin/base_controller/menu.rb:1:in `<top (required)>' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:251:in `require' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:251:in `block in require' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:236:in `load_dependency' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:251:in `require' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activeadmin-0. 
5.1/lib/active_admin/base_controller.rb:2:in `<top (required)>' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activeadmin-0. 
5.1/lib/active_admin/resource_controller/actions.rb:2:in `<module:ActiveAdmin>' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activeadmin-0. 
5.1/lib/active_admin/resource_controller/actions.rb:1:in `<top (required)>' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:251:in `require' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:251:in `block in require' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:236:in `load_dependency' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:251:in `require' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activeadmin-0. 
5.1/lib/active_admin/resource_controller.rb:2:in `<top (required)>' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activeadmin-0. 
5.1/lib/active_admin/batch_actions.rb:7:in `block in <top (required)>' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activeadmin-0. 
5.1/lib/active_admin/event.rb:25:in `call' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activeadmin-0. 
5.1/lib/active_admin/event.rb:25:in `block in dispatch' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activeadmin-0. 
5.1/lib/active_admin/event.rb:24:in `each' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activeadmin-0. 
5.1/lib/active_admin/event.rb:24:in `dispatch' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activeadmin-0. 
5.1/lib/active_admin/application.rb:187:in `load!' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activeadmin-0. 
5.1/lib/active_admin/application.rb:213:in `routes' 
     from C:in `routes' 
     from C:/Users/Me/Desktop/sample_app/config/routes.rb:2:in `block in <top 
(required)>' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2 
.3/lib/action_dispatch/routing/route_set.rb:282:in `instance_exec' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2 
.3/lib/action_dispatch/routing/route_set.rb:282:in `eval_block' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2 
.3/lib/action_dispatch/routing/route_set.rb:260:in `draw' 
     from C:/Users/Me/Desktop/sample_app/config/routes.rb:1:in `<top (require 
d)>' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:245:in `load' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:245:in `block in load' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:236:in `load_dependency' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/dependencies.rb:245:in `load' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3 
/lib/rails/application/routes_reloader.rb:40:in `block in load_paths' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3 
/lib/rails/application/routes_reloader.rb:40:in `each' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3 
/lib/rails/application/routes_reloader.rb:40:in `load_paths' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3 
/lib/rails/application/routes_reloader.rb:16:in `reload!' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3 
/lib/rails/application.rb:108:in `reload_routes!' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activeadmin-0. 
5.1/lib/active_admin/reloader.rb:34:in `reload!' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activeadmin-0. 
5.1/lib/active_admin/reloader.rb:61:in `block in attach!' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/callbacks.rb:429:in `_run__81379729__prepare__328171315 
__callbacks' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/callbacks.rb:405:in `__run_callback' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/callbacks.rb:385:in `_run_prepare_callbacks' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.3/lib/active_support/callbacks.rb:81:in `run_callbacks' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2 
.3/lib/action_dispatch/middleware/reloader.rb:74:in `prepare!' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2 
.3/lib/action_dispatch/middleware/reloader.rb:48:in `prepare!' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3 
/lib/rails/application/finisher.rb:47:in `block in <module:Finisher>' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3 
/lib/rails/initializable.rb:30:in `instance_exec' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3 
/lib/rails/initializable.rb:30:in `run' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3 
/lib/rails/initializable.rb:55:in `block in run_initializers' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3 
/lib/rails/initializable.rb:54:in `each' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3 
/lib/rails/initializable.rb:54:in `run_initializers' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3 
/lib/rails/application.rb:136:in `initialize!' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3 
/lib/rails/railtie/configurable.rb:30:in `method_missing' 
     from C:/Users/Me/Desktop/sample_app/config/environment.rb:5:in `<top (re 
quired)>' 

回答

0

您需要在與定義相同的模塊中進行操作。

module SessionsHelper 
    alias :sign_in_ :sign_in 
    undef :sign_in 
end 
+0

小心取消定義第三方方法。我沒有使用活動管理員,但可以在其他地方使用。 – andy 2013-03-05 12:02:17

+0

@andy你是對的。根據使用方式的不同,它可能會導致問題。 – sawa 2013-03-05 12:06:12

+0

這是我在嘗試啓動rails服務器時收到的錯誤消息:C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.3/lib/active_support 'load'中的/dependencies.rb:469:C:/sampleapp/app/helpers/sessions_helper.rb:49:語法錯誤 – syk 2013-03-05 12:15:05

相關問題