Question, can you have private and protected in a single Ruby on Rails controller? If not, which one is preferred in a devise controller, or a regular controller for a model?
Thanks
Question, can you have private and protected in a single Ruby on Rails controller? If not, which one is preferred in a devise controller, or a regular controller for a model?
Thanks
can you have private and protected in a single Ruby on Rails controller?
Yes, you can. Rails controllers are just classes, and classes can have any number and combination of private and protected blocks.
Use protected if you want to allow for inherited controllers to access the method. Use private if you want the method to be accessible only by the controller itself.