Protecting certain model attributes from being exposed in an API

In my current project, there are business and security requirements that
prevent certain values from being exposed. I was looking for a way to
specify which attributes in a model should be protected. This is what
come up with and I would love feedback as to whether or not it’s a valid
solution and how I could improve it.

Basically, I’m following the attr_accessible style and defining an
attr_private method for setting specific attributes (or methods) as

Your thoughts are much appreciated. Thanks in advance.


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