开发者

Good practice on ApplicationController

开发者 https://www.devze.com 2023-02-21 10:53 出处:网络
I am working on an application and I have quite some number of methods in the ApplicationController file. However, I find myself using a lot of params[:some_param] in my methods, which means that I am

I am working on an application and I have quite some number of methods in the ApplicationController file. However, I find myself using a lot of params[:some_param] in my methods, which means that I am directly usin开发者_如何学编程g the user submitted parameters to check conditions. I just want to make sure if this is a good practice of RoR programming.


Definitely not a good practice. Generally speaking, application controller code should be very limited, if any. If you feel that you need code for various models, you should most probably use a module. I would highly recommend that you refactor your code.

0

精彩评论

暂无评论...
验证码 换一张
取 消