Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MVC paradigm. Why only application_controller?

Rails uses the MVC paradigm. It's interesting in models, views, and controllers, really only controllers have an 'application' or parent controller. Actually there is an application_helper in rails but it really doesn't do much. What's the point of only have an application_controller where as models and in practice helpers do not have a parent?

like image 895
thenengah Avatar asked Feb 24 '23 10:02

thenengah


1 Answers

Models have a parent, ActiveRecord::Base ApplicationController is there because its too common to see application wide filters that you need in a web app for authentication/authorization etc. The application helper, again is there to put helper methods that get used across the application, beyond the scope of just one controller.

like image 70
Sohan Avatar answered Feb 26 '23 00:02

Sohan