activerecord

ActiveRecord Read Only Model

ActiveRecord is great in providing CRUD for your data models. In some cases, however, it’s necessary to prevent write access to these models. The data may be provided by an external source and should only be used as a reference in your application, for example. I’m going to show you how you can easily mark a Model as read only all the time. In this example I have a Item model like this: