When do you protect a method?

(I’m working through Agile again. Got halfway through last time).

How do you know when and when not to protect a method?

Specifically, in the depot application, we add price validation as a
protected method “because it shouldnâ??t be called from outside the
context of the model” (p 77).

Why wouldn’t you want the price validation called from outside of the
model? And why are we adding the restof the validation as unprotected?



This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs