user1899082
user1899082

Reputation:

Namespaced controllers and classes in Modules

I have done this command: rails g controller father/child and it has genersted this for me:

class Father::ChildController < ApplicationController
end

But my goal is to have this:

module Father
  class ChildController < ApplicationController

  end
end

Are these two the same? or I should use generate controller in a different way to achive that module like syntax?

Upvotes: 0

Views: 62

Answers (1)

bronislav
bronislav

Reputation: 782

They not the same. The second one is equivalent to the following:

class Father::ChildController < Father::ApplicationController
end

Upvotes: 3

Related Questions