Where i should put it ? controller, model or both?

hi, I’ve to check something like: the user can have the same object in
the wish list only once.
example:
the user put the object X in the wish list - ok
the user try to add the object X to the wish list another time --> not
ok, the user is redirected to another url with a notice
because i use the session and notice i think i’ve to put the control in
the controller(because the model doesn’t know anything about session,
redirect and notice), but i should put it also in the model?
usually what kind of controls i’ve to write in the controller and when
in the model?
thanks

in the model?
thanks

If your business logic mandates that the wish list has to have a unique
list of items, then that should go in your model so that regardless of
where you manage the wish list the rules hold up.

If it’s not mandated, but only in this one instance, then put the check
in
the controller.

Me, I’d put it in the model, and return an error if it’s duplicated that
your controller can use to redirect somewhere else.

-philip