Forum: Ruby on Rails nested class?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ffd881829651935d986c52d12279befb?d=identicon&s=25 Zhenning Guan (rubyernewbie)
on 2008-10-13 09:35
require 'observer'
require 'set'

class Content < ActiveRecord::Base
  include Observable

#somecode here that I hidden

class ContentTextHelpers
  include ActionView::Helpers::TagHelper
  include ActionView::Helpers::SanitizeHelper
  include ActionView::Helpers::TextHelper
end

+++++++++++++++++++++++

there's a Content class nested ContentTextHelers class. I'm a litte
confused about that.
what's nested class work for?
is only Ruby have nested class? like C++, is inherit class.
1b507a552850441a516948d488962d2e?d=identicon&s=25 Sniper Abandon (mokkai)
on 2008-10-14 15:11
Zhenning Guan wrote:
> require 'observer'
> require 'set'
>
> class Content < ActiveRecord::Base
>   include Observable
>
> #somecode here that I hidden
>
> class ContentTextHelpers
>   include ActionView::Helpers::TagHelper
>   include ActionView::Helpers::SanitizeHelper
>   include ActionView::Helpers::TextHelper
> end
>
> +++++++++++++++++++++++
>
> there's a Content class nested ContentTextHelers class. I'm a litte
> confused about that.
> what's nested class work for?
> is only Ruby have nested class? like C++, is inherit class.

ContentTextHelpers is the single class for Content class scope .
generally we can all classes are nested class of Object
This topic is locked and can not be replied to.