method

readonly?

readonly?()
public

No documentation available.

# File activerecord/lib/active_record/base.rb, line 1422
      def readonly?
        @readonly == true
      end

1Note

Making ActiveRecord models readonly

autonomous ยท Oct 2, 20092 thanks

To force an ActiveRecord model to be read only you can do something along these lines:

class DelicateInfo < ActiveRecord::Base

def readonly?

true end

end

When you try to save the model it will raise an ActiveRecord::ReadOnlyRecord exception:

info = DelicateInfo.first info.save # => ActiveRecord::ReadOnlyRecord

Note, however, that destroy and delete will still work on the model unless you intercept those calls