Welcome Guest, Not a member yet? Register   Sign In
Set Rules in model.
#7

(This post was last modified: 03-06-2015, 05:06 PM by cartalot.)

i like my controllers thin and commanding :-)
here's one of my reasons - almost always after a form validation - you are going to insert or update to a database.
so you are going to have a model with all of the relevant field names to do that. having the form validation in the same model,
or close by, makes it much easier to match the validation requirements with the database needs.

another possibility is doing the form setup and validation with configs which is how i started - i think there are some nettuts courses that taught me ths -- but its easier to call a model and again you can have relevant code together.

the other reason is that when code is touched, it can break. by keeping all those ever changing form details out of the controller,
much more likely to not break it. if there is a problem in a model method it (probably) will not take down
every single method in the controller.
Reply


Messages In This Thread
Set Rules in model. - by miiikkeyyyy - 03-03-2015, 09:17 AM
RE: Set Rules in model. - by mwhitney - 03-03-2015, 01:48 PM
RE: Set Rules in model. - by spjonez - 03-03-2015, 05:06 PM
RE: Set Rules in model. - by tapan.thapa - 03-03-2015, 09:18 PM
RE: Set Rules in model. - by spjonez - 03-04-2015, 06:45 AM
RE: Set Rules in model. - by mwhitney - 03-04-2015, 01:16 PM
RE: Set Rules in model. - by cartalot - 03-06-2015, 05:05 PM



Theme © iAndrew 2016 - Forum software by © MyBB