script/generate controller创建Modules的问题

Oct 19 2008 Published by under Web

今天在项目里准备把管理功能移进后台系统,于是创建根据controller的examples创建了一个模块:

Modules Example:
    ./script/generate controller 'admin/credit_card' suspend late_fee

    Credit card admin controller with URLs /admin/credit_card/suspend.
        Controller: app/controllers/admin/credit_card_controller.rb
        Views:      app/views/admin/credit_card/debit.html.erb [...]
        Helper:     app/helpers/admin/credit_card_helper.rb
        Test:       test/functional/admin/credit_card_controller_test.rb


./script/generate controller 'admin/credit_card'
因为安全方面的问题,文章里的module名都用帮助实例里的名字代替。
我使用如上的方法创建了一个module以后,在浏览器里是直接不能访问的,于是又在routes.rb里添加路由映射的命名空间:
   map.namespace :admin do |admin|
     admin.resources :credit_card
   end
这样做了以后就有一个奇怪的现象产生。

Continue Reading »

One response so far