No, in a normal Rails project this is not necessary. Just name your models and controllers in the usual way, for example, User or UsersController.
Another thing is that when your project grows in size, you may need to organize your models in submodules. One way to do this is to extend your models with applications, for example, show here or.
Regarding the organization of controllers, one approach is to create a module in the lib directory, which you then include in your ApplicationController, for example:
In lib/authentication.rb :
module Authentication def self.included(base) base.send :before_filter, :login_required base.send :helper_method, :current_user, :logged_in? end def current_user @current_user ||= User.find_by_remember_token(cookies[:remember_token]) if cookies[:remember_token].present? end #... end
In app/controllers/application_controller.rb
class ApplicationController < ActionController::Base include Authentication
For this you need to add
config.autoload_paths << "#{config.root}/lib"
to your config/application.rb file
However, if you plan to create a Rails project as a Rails Engine, you may want to follow a specific naming convention. A good example of a Rails Engine is forem .
source share