首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >RAils授权逻辑和Hobo

RAils授权逻辑和Hobo
EN

Stack Overflow用户
提问于 2010-04-30 04:59:26
回答 1查看 495关注 0票数 0

有没有人知道如何将Hobo作为管理子站点整合到运行在authlogic上的现有rails应用程序中。

我一直在关注这个tutorial,但它不起作用。

请提供任何帮助或教程链接!

对于任何想要尝试的人来说,一些错误的代码:

代码语言:javascript
复制
~/dev/copy> ./script/server
=> Booting Mongrel
=> Rails 2.3.4 application starting on http://0.0.0.0:3000
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:426:in `load_missing_constant': Expected /Users/Mister/dev/copy/app/controllers/admin/admin_controller.rb to define Admin::AdminController (LoadError)
    from /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:80:in `const_missing'
    from /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/inflector.rb:361:in `constantize'
    from /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/inflector.rb:360:in `each'
    from /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/inflector.rb:360:in `constantize'
    from /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/core_ext/string/inflections.rb:162:in `constantize'
    from /opt/local/lib/ruby/gems/1.8/gems/hobo-1.0.0/lib/hobo/model_controller.rb:61:in `all_controllers'
    from /opt/local/lib/ruby/gems/1.8/gems/hobo-1.0.0/lib/hobo/model_controller.rb:57:in `each'
    from /opt/local/lib/ruby/gems/1.8/gems/hobo-1.0.0/lib/hobo/model_controller.rb:57:in `all_controllers'
    from /opt/local/lib/ruby/gems/1.8/gems/hobo-1.0.0/lib/hobo/model_router.rb:97:in `add_routes_for'
    from /opt/local/lib/ruby/gems/1.8/gems/hobo-1.0.0/lib/hobo/model_router.rb:83:in `add_routes'
    from /opt/local/lib/ruby/gems/1.8/gems/hobo-1.0.0/lib/hobo/model_router.rb:83:in `each'
    from /opt/local/lib/ruby/gems/1.8/gems/hobo-1.0.0/lib/hobo/model_router.rb:83:in `add_routes'
    from /opt/local/lib/ruby/gems/1.8/gems/hobo-1.0.0/rails/../lib/hobo.rb:73:in `add_routes'
    from /Users/Mister/dev/copy/config/routes.rb:6
    from /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/routing/route_set.rb:226:in `draw'
    from /Users/Mister/dev/copy/config/routes.rb:1
    from /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:145:in `load_without_new_constant_marking'
    from /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:145:in `load'
    from /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:521:in `new_constants_in'
    from /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:145:in `load'
    from /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/routing/route_set.rb:286:in `load_routes!'
    from /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/routing/route_set.rb:286:in `each'
    from /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/routing/route_set.rb:286:in `load_routes!'
    from /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/routing/route_set.rb:266:in `reload!'
    from /Users/Mister/.gem/ruby/1.8/gems/rails-2.3.4/lib/initializer.rb:537:in `initialize_routing'
    from /Users/Mister/.gem/ruby/1.8/gems/rails-2.3.4/lib/initializer.rb:188:in `process'
    from /Users/Mister/.gem/ruby/1.8/gems/rails-2.3.4/lib/initializer.rb:113:in `send'
    from /Users/Mister/.gem/ruby/1.8/gems/rails-2.3.4/lib/initializer.rb:113:in `run'
    from /Users/Mister/dev/copy/config/environment.rb:11
    from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
    from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
    from /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:in `require'
    from /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:521:in `new_constants_in'
    from /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:in `require'
    from /Users/Mister/.gem/ruby/1.8/gems/rails-2.3.4/lib/commands/server.rb:84
    from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
    from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
    from ./script/server:3

应用程序中的环境和gem:

代码语言:javascript
复制
RAILS_GEM_VERSION = '2.3.4' unless defined? RAILS_GEM_VERSION

ENV['RAILS_ENV'] ||= 'development'
config.gem 'hobo'
config.gem "RedCloth", :version => ">= 4.2.2"
config.gem "authlogic"
  config.gem "cancan"
  config.gem "jrails"
  config.gem "peteonrails-vote_fu", :source => "http://gems.github.com", :lib => "vote_fu"

路由:

代码语言:javascript
复制
map.site_search  'search', :controller => 'admin/front', :action => 'search'
  map.admin '/admin', :controller => 'admin/front', :action => 'index'

  Hobo.add_routes(map)
EN

回答 1

Stack Overflow用户

发布于 2010-04-30 05:04:01

大胆猜测..。

admin/admin_controller.rb中,您拥有:

代码语言:javascript
复制
class AdminController < ApplicationController
   ...
end

并且您需要:

代码语言:javascript
复制
class Admin::AdminController < ApplicationController
  ...
end

来覆盖命名空间。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/2740741

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档