I have a basic User model in app/models/user.rb. I also have a few services in lib. For example, I have lib/services/user/creation_service.rb. The following code generates an error:
# lib/services/user/creation_service.rb
module Services
module User
class CreationService
...
def create_new_user
# User.new below causes an error because it defaults to Services::User which is a module instead of User which is an ActiveRecord class
User.new
...
end
...
end
end
end
Is there any way to get User.new to refer to app/models/user.rb instead of the Services::User module in the code above?
Any help would be greatly appreciated!
::User.newwould do the trick