How to know if model attribute is protected?

I’m adding some meta-methods to a plugin and would really like to be
able to know if an attribute is protected or not in my model.
Unusually, googing hasn’t turned up an answer. I know I could try an
assignment and then rescue the exception (assuming the default whiny
behaviour is on) but thats not a pleasing approach.

Thanks for any help or pointers,

–Kip

Its not in the API description for ActiveRecord::Base, but it is
mentioned in the source code for attr_protected.
#protected_attributes returns an array of the attributes that are
protected.

–Kip

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