views:

52

answers:

0

Help! in my rails controllers, there is a 'Admin' namespace. (My the structure of the controllers dir is like this :
app/controllers:
home_controller.rb
...
admin/posts_controller.rb
admin/pages_controller.rb

The 'Admin' will automatically become a Module constant (I know it from the console: 'puts Admin => Module');

And in my initializers, ther is a init.rb which has codes like this:

Object.const_set('A', 'a')
Object::Admin.const_set('B', 'b)

Then I run the console:

>> puts Object::A
"a"               #just fine
=> nil
>> puts Object::Admin::B
NameError: uninitialized constant Admin::B    # What's wrong?

Why diffrent results? Who can help me to make the Admin::B part works?