mardi 6 janvier 2015

rails How to use reflection/introspection for attr_accessible on a model?

I'm using Rails 3, so I'm using attr_accessible to white list attributes. I want to be able to view the attributes listed for attr_accessible for a model and also to change them or even to remove attr_accessible from a model.


I want to be able to do something like this:



MyModel.class_eval{undef :attr_accessible}


which currently gives the error



undefined method `attr_accessible' for class `MyModel' (NameError)





Aucun commentaire:

Enregistrer un commentaire