Some basic rules to follow, for diff. rails components. Please add comment if you want to add anything.
##Controllers
- Extract common code in controller action, which loads data from DB using finder methods with params as arguments.
- Same for any service object loading.
- Above two cases, if being used in more than one controller, then define a concern using included do
before_action :finder_method end
and include that in both. - Do not write separate controller for API, instead use respond_to with diff. data format.