Reputation: 3869
I have a user model:
class User < ActiveRecord::Base
end
This model is used to store all the corporate users
Then I would like to have another user model inside my workplace namespace:
class Workplace::User < ActiveRecord::Base
end
This class would be used for the users of my users in their workplace
It doesn't work and rises following error message when I want to migrate:
Expected .../app/models/workplace/user.rb to define User
I don't have this issue with models using different names but I want to use the same name (makes more sense to me...)
How could I? Thanks!!!
Upvotes: 2
Views: 1950
Reputation: 2237
When you declare classes in a name space, rails expects the files for the MVC to be placed in a folder with the same name as the namespace.
Try placing them in
app/models/workplace/user.rb
app/controllers/workplace/user_controller.rb
app/views/workplace/
Upvotes: 2