Setting a field to read-only in Rails after it's created
You can add custom validation method to your model:
# Project model
validate :forbid_changing_name, on: :update
private
def forbid_changing_name
errors.add :name, "can not be changed!" if self.name_changed?
end
How about setting it to read only? The attr_readonly
method allows you to do it, see:
API Docs