Croplio
unread,Jul 25, 2010, 11:09:57 AM7/25/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ruby on Rails: Talk
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?