Class Helper in Rails

I was wondering if we could use Helpers as class in Rails. The interpreter requires helper to be a Module, but I want it as a class.

I have two solutions :

module ModHelper
    class C
    #stuff
    end
end

Which impose me to write ModHelper::C.my_method instead of ModHelper.my_method ...

Or :

module ModHelper
#nothing
end

class C
#stuff
end

Which is a bit dirty.

Is someone have a better solution ?

Upvotes: 0

Views: 284

Answers (1)

iced
iced

Reputation: 1582

I just realized that you can just do ShortName = MyModule::UselessName.

Upvotes: 2

Related Questions